从admin SDK撤消或注销Firebase用户令牌

时间:2019-09-13 06:24:42

标签: node.js firebase firebase-authentication firebase-admin

我现在正在使用Firebase客户端sdk在服务器上使用signInWithEmailAndPassword方法登录,现在我也想从服务器(admin sdk)代码中取消对用户的身份验证/注销。我尝试了以下代码,但旧令牌仍在工作。我们可以做什么?自定义令牌在这种情况下是否可以工作?基本上,我想在服务器上管理用户登录和注销,而不是依赖Firebase客户端SDK

FirebaseAdmin.auth().revokeRefreshTokens(uid)
  .then(() => {
    return FirebaseAdmin.auth().getUser(uid);
  })
  .then((userRecord) => {
    return new Date(userRecord.tokensValidAfterTime).getTime() / 1000;
  })
  .then((timestamp) => {
    //return valid response to ios app to continue the user's login process
  });

0 个答案:

没有答案
相关问题