Firebase函数signInWithCustomToken与Node.js一起未定义
所以我创build了一个自定义标记
const token = authRef.createCustomToken(options.userId, { app: appRootName, debug: !!options.debug });
然后尝试签入
return authRef.signInWithCustomToken(token).then((user) => { return user; });
自定义创build令牌成功,但signInWithCustomToken吐出这个错误。
TypeError: authRef.signInWithCustomToken is not a function
这是针对nodejs的Firebase 3,并已设置服务帐户。 该应用程序已正确初始化(或者代币生成首先不起作用),这里有什么问题?
我得到了同样的错误,希望下面的代码可以解决你的问题。
小心使用apiKey或serverKey
var firebase = require('firebase') firebase.initializeApp({ apiKey: '*******', databaseURL: 'https://*****.firebaseio.com' }) var customToken = '*********' firebase.auth().signInWithCustomToken(customToken).catch(function(error) { var errorMessage = error.message console.log(errorMessage) })
实际的问题是
authWithCustomToken
存在于firebase
而不是在使用Firebase安全function时常用的firebase-admin
。
- 如何在Node.js中重新使用由Play Framework 2.2设置的签名cookie?
- 在对Google表单进行多次调用时,API身份validation不适用于第二次调用:请求的身份validation范围不足
- 我应该如何存储由RESTful API生成的令牌?
- Nodemailer不断拒绝无效login身份validation(不使用Gmail)
- Node.jsrest调用需要证书的服务器
- 卫星然后authentication后不叫
- JWT微服务体系结构中的身份validation
- 错误:401(未授权),Passport身份validation在节点中
- PassportJS events.js:160 //未处理的错误连接超时