Firebase Admin SDK apply action code for email verification

戏子无情 提交于 2021-01-27 05:48:32

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/46837750/firebase-admin-sdk-apply-action-code-for-email-verification

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!