1
votes

I am currently using email authentication via Firebase Auth on An Android Application. Everything is correctly setup. Also when calling createUserWithEmailAndPassword. If it is successful i am using ActionCodeSettings following Firebase authentication tutorial in order to sent the verification email.

If i open the link in the email received on a browser on the Desktop then the user's email is successfully verified (the flag FirebaseUser.isEmailVerified returns true)

However i tried to use deep linking. So if the user clicks on the link on the mobile device is redirected inside the app where i have deep linking listeners. I would expect that the flag isEmailVerified would be updated as soon as i receive the deep link data inside the app but it is not). Actually probably should be verified even when pressing the link since the current way of verifying the user's email is just opening a webpage saying email verified.

Having thoroughly search the web i haven't seen any example of any developer trying to achieve the same thing, which in my believe is a better user experience instead of opening a browser window to be verified and then try to redirect the user in the app.

Any help is greatly appreciated.

1

1 Answers

1
votes

So I assume, that you are going to the action callback landing webpage where user is verified and then on click, the user is redirected to the android app. At that point you need to:

  • Reload the user: currentUser.reload() This will update the user.isEmailVerified() return value to pick up the latest changes.

  • Force refresh the token on the user: currentUser.getIdToken(true) This will update the email_verified field in the token payload in case you are checking that in your backend or Firebase rules.