2

In the FlutteFire documentation, it says that "Firebase will send an automated email to the user with a unique code. This code can then be entered via the applyActionCode() method. You can first check whether the code is valid by using the checkActionCode() method" Yet when I send an email verification, it shows a link. Documentations

In my email template on Firebase console, it is still showing an email link. Email Template

I want to be able to send a code instead, just because it allows for a better user experience in my opinion. What do I do in order to get the email verification to send a code instead? I've looked everywhere and can't find anything helpful.

Damanjit Hundal
  • 328
  • 4
  • 17

1 Answers1

2

At the time of writing, you cannot extract the oobCode value that is generated by Firebase Auth.

If you want to use this code, you need to extract it from the Query String in the web page that corresponds to this URL (note that you can adapt the URL in the template in order it points to another URL that you control, e.g. that is exposed by your app).

Renaud Tarnec
  • 79,263
  • 10
  • 95
  • 121
  • Hey Renaud, thanks for the reply. In the flutterfire documentation, it makes it seem like that the unique code that is being sent would be something like '123456' (a 6 digit number string), but as you pointed out it probably is the oobCode that is included in email verification link. I guess in order to solve my problem, I would have to create a custom URL to handle this? – Damanjit Hundal Oct 01 '20 at 09:31
  • "I would have to create a custom URL" => Yes. Have a look at https://firebase.google.com/docs/auth/custom-email-handler fro more guidance. – Renaud Tarnec Oct 01 '20 at 09:39
  • Right, I've been on that page several times hoping that there would be a better solution to handle email verification with a code instead of a link, but alas I guess there isn't. I guess I misinterpreted the flutterfire documentation, thanks Renaud! – Damanjit Hundal Oct 01 '20 at 09:47
  • 1
    Note that even with the Admin SDK you cannot get the `oobCode`, only the link (with `admin.auth().generateEmailVerificationLink()`) – Renaud Tarnec Oct 01 '20 at 09:54
  • Do you know of any resource that has implemented a seamless user experience in Flutter with email verification? I just want to be able to send the verification email, and then automatically redirect to the homepage inside my app after the user is verified. Even on stackoverflow, I see people using timers with reload and that seems to be more of a workaround then a clean solution. – Damanjit Hundal Oct 01 '20 at 10:02
  • Thanks for the help Renaud! Will dive into it more. – Damanjit Hundal Oct 01 '20 at 10:37