小编Seu*_*hin的帖子

getIdToken() 不是函数,即使它像 firebase 文档中的函数一样使用

我现在正在处理 firebase auth,我正在关注这个 Firebase 文档。

访问https://firebase.google.com/docs/auth/admin/manage-cookies#sign_in

// When the user signs in with email and password.
firebase.auth().signInWithEmailAndPassword('user@example.com', 'password').then(user => {
  // Get the user's ID token as it is needed to exchange for a session cookie.
  return user.getIdToken().then(idToken = > {
    // Session login endpoint is queried and the session cookie is set.
    // CSRF protection should be taken into account.
    // ...
    const csrfToken = getCookie('csrfToken')
    return postIdTokenToSessionLogin('/sessionLogin', idToken, csrfToken);
  });
})
Run Code Online (Sandbox Code Playgroud)

我希望我可以通过使用该功能获得令牌。但它不起作用,因为代码中的用户没有 getIdToken() 函数。

javascript node.js firebase firebase-authentication

6
推荐指数
2
解决办法
3497
查看次数