[英]How to create a passwordResetLink using the Firebase admin API?
I'm trying customize the user experience in my firebase project and hence as well need to create custom email templates including the necessary action links. 我正在尝试自定义Firebase项目中的用户体验,因此也需要创建自定义电子邮件模板,其中包括必要的操作链接。
Unfortunately I'm unable to get my firebase cloud function to create the passwordResetLink
. 不幸的是,我无法获得Firebase云功能来创建
passwordResetLink
。 No matter what I try the function doesn't seem to be valid despite being setup according to the firebase docs . 无论我尝试什么,尽管根据firebase docs进行了设置,但该功能似乎都无效。
Error: auth.generatePasswordResetLink is not a function 错误:auth.generatePasswordResetLink不是函数
I tried to reinstall the node_modules as well already but without any success :( 我已经尝试过重新安装node_modules,但是没有成功:(
const admin = require('firebase-admin');
const auth = admin.auth();
const functions = require('firebase-functions');
exports = module.exports = functions.https.onCall((data) => {
const email = data.email
const actionCodeSettings = {
url: 'http://localhost:3000',
handleCodeInApp: false
};
auth.generatePasswordResetLink(email, actionCodeSettings)
.then((link) => {
// return link
return { link: link }
})
.catch((error) => {
// Some error occurred.
});
})
The function above should simply return the passwordResetLink
so I can work with it afterwards to create a custom email template. 上面的函数应该只返回
passwordResetLink
以便以后可以使用它来创建自定义电子邮件模板。
You seem to be using an old version of firebase-admin
. 您似乎正在使用旧版本的
firebase-admin
。 The API you're trying to invoke was added in v6.2.0 of the SDK. 您尝试调用的API已添加到SDK的v6.2.0中。 Make sure you have at least that version.
确保您至少具有该版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.