railgun
railgun

Reputation: 1021

Firebase Admin SDK apply action code for email verification

The Firebase Customize the Email Action Handler guide gives an example of verifying a user's email address on a custom URL to a site hosted through Firebase.

However, I want the custom URL to point to a Firebase cloud function endpoint URL and use admin SDK to verify the oob code instead. But there is no such function as applyActionCode for the admin.auth().

Is verifying email through a hosted site using javascript the only way to go? I don't really want to expose the code to the browser.

Upvotes: 6

Views: 3725

Answers (1)

jcchuks
jcchuks

Reputation: 907

As of 3/8/2020, this applyActionCode is not part of the admin sdk. A kludge for this will be to verify the oobCode on the server/backend/cloud function using the rest api https://firebase.google.com/docs/reference/rest/auth/#section-send-email-verification.

How? since you customized the email action handler, assume it is pointed to an endpoint you have control over (e.g your domain/cloud function), then on the client side, you can obtain the url parameters (including the oobcode) in the url and send to your backend for verification using the REST API.

Upvotes: 2

Related Questions