Javascript 错误:auth.sendSignInLinkToEmail不是函数
这给了我一个错误。我已在firebase中启用的设置。 这里有什么问题?Javascript 错误:auth.sendSignInLinkToEmail不是函数,javascript,firebase-authentication,firebase-admin,Javascript,Firebase Authentication,Firebase Admin,这给了我一个错误。我已在firebase中启用的设置。 这里有什么问题? 此函数是在firebase云函数中编写的。只有通过客户端SDK,才能通过firebase身份验证向用户发送电子邮件和SMS消息 您使用的是管理SDK,它没有此功能,因为它太容易被滥用 因此,您必须在客户端应用程序代码中实现此功能,使用常规客户端/Web SDK进行Firebase身份验证。因此我们无法在Firebase云函数上编写此功能???这是正确的。发送sendSignInLinkToEmail的请求必须来自用户登录的
此函数是在firebase云函数中编写的。只有通过客户端SDK,才能通过firebase身份验证向用户发送电子邮件和SMS消息 您使用的是管理SDK,它没有此功能,因为它太容易被滥用
因此,您必须在客户端应用程序代码中实现此功能,使用常规客户端/Web SDK进行Firebase身份验证。因此我们无法在Firebase云函数上编写此功能???这是正确的。发送
sendSignInLinkToEmail
的请求必须来自用户登录的设备。嘿@SagarGaikwad这里还需要什么?如果我的答案有用,请单击向上投票按钮(▲) 如果它回答了您的问题,请单击复选标记(✓) 接受它。这样别人就会知道你已经得到了(足够的)帮助。也请参见
const firebase = require("firebase-admin");
const auth=firebase.auth();
// create user in firebase data
var actionCodeSettings = {
// URL you want to redirect back to. The domain (www.example.com) for this
// URL must be in the authorized domains list in the Firebase Console.
url: 'https://www.example.com/finishSignUp?cartId=1234',
// This must be true.
handleCodeInApp: true,
dynamicLinkDomain: 'example.page.link'
};
// [END auth_email_link_actioncode_settings]
app.get("/firebase/api/createUser",function(req,resp){
auth.sendSignInLinkToEmail("sagar@gmail.com",actionCodeSettings)
.then((userCredential) => {
// Signed in
var user = userCredential.user;
console.log("user created :"+user);
resp.send("--"+userCredential);
// ...
})
.catch((error) => {
var errorCode = error.code;
var errorMessage = error.message;
// ..
});
});