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
。
- Angular Node JWT令牌authentication和页面redirect
- 即使login后,NodeJs Passport isAuthenticated()也会返回false
- sails-auth模块给出“不能读取属性'loadStrategies'的未定义的”
- Passport身份validationcallback不传递req和res
- 模型动作的Sails.jsauthentication
- Node.js module.exports护照已authentication到路由
- 使用Firebase身份validation和Express身份validation社交login?
- 要求Passport.js / Node.js目录(除了一个页面)的身份validation?
- Nodejs身份validation