gpt4 book ai didi

node.js - Firebase 的云功能 : signInWithEmailAndPassword is not a function

转载 作者:太空宇宙 更新时间:2023-11-03 22:10:12 25 4
gpt4 key购买 nike

我开始使用 Cloud Functions with Firebase 编写代码。在以下函数中,testCreateUserAccount 成功。testLogin 在运行时失败并出现类型错误,指出“signInWithEmailAndPassword 不是函数

从我在文档中看到的,createUsersignInWithEmailAndPassword属于同一类,因此我不清楚为什么尝试调用signInWithEmailAndPassword会失败。有任何想法吗?谢谢!

"use strict"; 

var functions = require('firebase-functions');
const admin = require('firebase-admin');

admin.initializeApp(functions.config().firebase);

exports.testCreateUserAccount = functions.https.onRequest ((req, res) => {
var email = "joe@example.com";
var password = "joejoe";

admin.auth().createUser({
email: email,
password: password,
disabled: false
});
} );


exports.testLogin = functions.https.onRequest ((req, res) => {
var email = "joe@example.com";
var password = "joejoe";

admin.auth().signInWithEmailAndPassword(email, password);
} );

最佳答案

您在服务器端使用了admin.auth().signInWithEmailAndPassword(email, password),您必须在客户端使用它。

关于node.js - Firebase 的云功能 : signInWithEmailAndPassword is not a function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44532818/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com