How to handle email verification flow when users sign up with Google OAuth in a way that avoids the verify account page? Answered
Hi everyone, I am finding that when users sign up with Google, rather than entering email and password, they are automatically verified. This is a problem because they are sent to the verify your account page - without having actively verified their account and there isnt an automatic redirect. Any help would be appreciated thank you.
Comments
6 comments
That makes sense. Is there a way for them to not be taken to the verification screen? They should be taken to the sign up redirect rather than the verification required redirect no?
There's no way to set a custom verification in memberstack dashboard, for that specific rule. So my solution is since all your newly registred users are already going to the verified page, in there you add an extra check that if they are verified they will automatically redirect where you said them to be. They probably won't even notice they first got to the verified page, they redirection would be quick
Many people use a "success page strategy" where the success page is a blank page with a bunch of logic on the background to redirect the user depending on different conditions.
In this case, since it's a small condition, I'm only suggesting you do the redirect logic in the same page. The user should get redirected while the page is still loading
Please you have a code snippet I could use for the redirect on the verify your account page? I tried this but it didnt work:
Did you tried the one that I shared earlier? 😅
MemberStack.onReady is from version 1.0, it won't work if you're using v2
I prefer to get the data from localStorage instead of using getCurrentMember method because that way I don't have to wait a few milliseconds to get the response from memberstack server.
The less requests there are on the page the better performance would get 🙂 like less loading times
Oh it was not there before. I used it and it worked now thanks 🙂
Please sign in to leave a comment.