如何使用Firebase自己的令牌进行重新认证

时间:2020-03-26 22:03:01

标签: javascript firebase firebase-authentication jwt token

在线查看和在Firebase文档中,我找不到使用先前返回的令牌(JWT)重新认证用户的方法。我确实找到了firebase.auth().signInWithCustomToken(token),但似乎不是我应该使用的。有没有办法使用Firebase SDK做到这一点?

const { user } = await firebase.auth().signInWithEmailAndPassword(email, password)
const token = await user.getIdToken(true) // will be stored for the next session

// ...

// next session after retrieving the persisted token
const { user } = await firebase.auth().signInWithCustomToken(`Bearer ${token}`) // response status 400

感谢您的帮助。

0 个答案:

没有答案