我尝试登录到我的应用程序,该应用程序利用了 Google OAuth 流程。我过去已成功登录到此应用程序,方法是转到
localhost:5000/auth/google
当我选择我的电子邮件时,该过程只挂起大约一分钟,然后我得到:
TokenError: Code was already redeemed.
发生在localhost:5000/auth/google/callback
,我认为这可能不是问题,因为它是我authRoutes.js
下面文件中的一条路线:
const passport = require('passport');
module.exports = (app) => {
app.get(
'/auth/google',
passport.authenticate('google', {
scope: ['profile', 'email']
})
);
app.get('/auth/google/callback', passport.authenticate('google'));
app.get('/api/logout', (req, res) => {
req.logout();
// prove to whoever is
// making request that
// they are no longer signed in
res.send(req.user);
});
app.get('/api/current_user', (req, res) => {
res.send(req.user);
});
};
我想我会通过转到localhost:5000/api/current_user
哪个应该将用户的googleID
和呈现_id
为对象来检查,但是我得到一个空白屏幕,这意味着我没有成功登录。
我不确定这里发生了什么。