Redirecting user away from web3auth modal IF NO account exists

Initial state:
User is NOT logged in
User has NO ACCOUNT previously established

Description
When a user attempts to login and the web3auth modal comes up (React Native, webkit within mobile app), but the account does not exist, we need the web3auth to return the error condition and exist the flow so we can redirect the user back to the sign up flow, because the sign up flow sequence requires other checks before they can establish an account (and the associated key).

Question
How do I setup the flow so it ends the web3auth flow and returns a status condition (i.e.: user has no account) so we can follow a different conditional branch?

Thank you!

Hi @fadi1,

Hope you’re doing well! While we don’t currently have that option available, you can achieve similar functionality by performing a previous checkout or a later checkout using your database. If the user doesn’t exist, you can redirect them to a specific page where you can prompt them for more details.

Thanks :pray: @TomTom. I can count on one hand the # of folks who write “Hope you’re well” when messaging. I am one of those… :blush: Nice to get to know one more! Still on one hand, btw!

I’d like to share our user flow.

Pre-checkout: Here’s the user flow.

  1. User clicks/taps to login (Note: we have NO knowledge of who they are in advance)
  2. web3auth modal invoked → to login
  3. User enters creds in web3auth modal (how would our app get any info about what they entered since the web3auth provides no feedback until the process is over).

Our login is based on a user having a unique private key. It is used to access the user’s Lit access-controlled primitives & their hashed DB records. The private key is in essence the user handle. No private key → no login.

Post-Checkout
Even with an explanation in advance, some users will simply forgo reading it and go ahead and attempt to “login”. If they establish a login & a key, they think they’re in. But once we see a key and we do note they didn’t finish their onboarding, the following happens:

  1. They have stranded a private key which counts as an active user against the web3auth MAUs,
  2. MOST IMPORTANTLY it frustrates the user. Because we’d push them back into a different flow where they would have to do a pre-check step of establishing their identity. This friction create a horrible UX and alienates users. This horrible UX is the hallmark of crypto over the past 5 years.

I can explain why there’s a need for the flow to have a specific sequence (it’s primarily related to sovereign privacy preserving ZK-regulatory compliance).

But before I do, I want to understand if there’s a better solution. So can you help me understand what you intended? Thank you.

Hi @TomTom

Post-checkout can work if web3auth returns the list of methods (e.g.: if using Google, email OTP & device passkey, the JSON would include
{
Google: email@gmail.com,
email: example@example.com,
passkey: some_id
}

Is there some way to get the API to return this info?

Hi @fadi1

did you try with https://web3auth.io/docs/sdk/pnp/react-native/usage#getting-the-user-information ?

const userInfo = web3auth.userInfo();
{  
"aggregateVerifier": "tkey-google",  
"email": "john@gmail.com",  
"name": "John Dash", 
"profileImage": "https://lh3.googleusercontent.com/a/Ajjjsdsmdjmnm...",  
"typeOfLogin": "google",  
"verifier": "torus",  
"verifierId": "john@gmail.com",  
"dappShare": "<24 words seed phrase>", // will be sent only incase of custom verifiers  
"idToken": "<jwtToken issued by Web3Auth>",  
"oAuthIdToken": "<jwtToken issued by OAuth Provider>", // will be sent only incase of custom verifiers  
"oAuthAccessToken": "<accessToken issued by OAuth Provider>" // will be sent only incase of custom verifiers
}

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.