Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 417
Aaron Zorel Avatar asked Oct 19 '17 19:10

Aaron Zorel


1 Answers

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.

like image 177
jcchuks Avatar answered Nov 05 '22 18:11

jcchuks