Customized email verification success page using Firebase
Asked Answered
G

1

5

I am generating email verification using the default Firebase function. The default email verification success page looks like that:

image

I want to customize the response page after successful email verification. Is there a way to do that?

Guildhall answered 14/4, 2021 at 12:32 Comment(2)
You'll have to setup your own server to handle verification for that.Gaillardia
I think a custom email action handler should allow that: firebase.google.com/docs/auth/custom-email-handlerSherry
T
6

I want to customize the response page after successful email verification. Is there a way to do that?

Yes, as Frank indicated in his above comment, it is possible and the documentation he refers to explains the mechanism.

As explained in this doc (and also in my other answer :-) ), you need to build a web page in which you will:

  1. Get the values passed as QueryString parameters (e.g. mode or oobCode)
  2. Call, from this web page, the applyActionCode() method of the Firebase JavaScript SDK, passing the values of these parameters to the method.
  3. Upon successful verification, do something, like redirect the user to your app login page.

What's important to note is that you have two ways to generate the email sent to the user (which contains the link to the page described above):

1. Rely on the default Firebase mail mechanism. In order to customize the URL of the verification link (e.g. you want to redirect to https://www.myrapp.com/emailVerifyScreen) you need to change the base URL as shown in the below image ("Customize action URL"). Also explained here in the doc.

enter image description here

2. Send the email through a Cloud Function (or through a server you own). In this case you need to:

a/ Call the generateEmailVerificationLink() method of the Admin SDK, which returns a link

b/ Generate an email containing this link

c/ Send the email to the user (via an SMTP server you control or via a microservice like Mailjet or Sendgrid)


You may have a look at these other answers:

Tritium answered 14/4, 2021 at 17:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.