// Wrap your App with OreidProvider<OreidProvideroreId={oreId}> <App /></OreidProvider>// Example Login Component exportconstLogin:React.FunctionComponent= () => {constoreId=useOreId();constonClick= () => {oreId.popup.auth({ provider:'google' }).then(onSuccess).catch(onError); };return <buttononClick={onClick}>Login to Google</button>;};...// access user dataconstuserData=awaitoreid.auth.user.getData()console.log(`Hello ${userData.name}`)
Step 4 - Launch OnRamper Flow
constsignTransaction=async () => {constuserChainAccounts=oreId.auth.user.data.chainAccounts;// Select the currency account that you would like to default to in the OnRamper flow// The user can select a different account using a dropdown menu if they wishconstethAccount=userChainAccounts.find(ca =>ca.chainNetwork ==='eth_main')// These are the properties required to launch the popupconstonramperBuy= { chainAccount:ethAccount.chainAccount, chainNetwork:ethAccount.chainNetwork, };try {// launch the OnRamper flowawaitoreId.popup.buy({ onramperBuy }) } catch (error) {console.log(error) } }