强制令牌刷新,但令牌仍然过期?

var app = angular.module('app', ['firebase']); const setAppCookie = () => firebase.auth().currentUser.getToken(true).then(token => { Cookies.set('token', token, { domain: window.location.hostname, expire: 1 / 24, path: '/', secure: true }); }); const unsetAppCookie = () => Cookies.remove('token', { domain: window.location.hostname, path: '/', }); app.factory("Auth", ["$firebaseAuth", function ($firebaseAuth) { return $firebaseAuth(); }]); app.controller("ctrlHead", ["$scope", "Auth", "$window", function ($scope, Auth, $window) { $scope.auth = Auth; $scope.auth.$onAuthStateChanged(function (firebaseUser) { if (firebaseUser) { setAppCookie(); localStorage.setItem("authenticated", JSON.stringify("yay!")); } else { localStorage.setItem("authenticated", JSON.stringify(null)); } }); $scope.authenticated = JSON.parse(localStorage.getItem("authenticated")); }]); 

这是我使用Firebaselogin后设置令牌的代码^

这是检查服务器上的令牌的代码:

 router.get('/page', function(req, res, next) { global.page_name = current; const { token } = req.cookies; if (!token || token == undefined) { global.page_name = "..."; res.redirect("/"); } else { admin.auth().verifyIdToken(token) .then(decodedToken => { }).catch(err => { console.log(err); global.page_name = "..."; res.redirect("/"); }); } }); 

虽然我将令牌设置为强制刷新,但我无法login并始终得到以下错误:

{错误:Firebase ID令牌已过期。 从您的客户端应用程序获取新的令牌,然后重试。 有关如何检索ID令牌的详细信息,请参阅https://firebase.google.com/docs/auth/admin/verify-id-tokens 。

到底是怎么回事 ? 我做错了什么?