NodeJS Google + API错误:项目中尚未使用旧版人员API?

vlju58qv  于 2023-01-30  发布在  Node.js
关注(0)|答案(1)|浏览(165)
const router = require('express').Router();
const passport = require('passport');
// auth login
router.get('/login', (req, res) => {
    res.render('login', { user: req.user });
});

// auth logout
router.get('/logout', (req, res) => {
    // handle with passport
    res.send('logging out');
});

// auth with google+
router.get('/google',passport.authenticate('google',{
  scope:['email']
}));

router.get('/google/redirected',passport.authenticate('google',{
  successRedirect:"/",
  failureRedirect:"/login"
}),(req,res)=>{
  res.send('Redirected Successfully !')
})
module.exports = router;

GooglePlusAPIError: Legacy People API has not been used in project 297453248242 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/legacypeople.googleapis.com/overview?project=297453248242 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry. at C:\Users\VAIBHAV\Desktop\GoogleAuth20\node_modules\passport-google-oauth20\lib\strategy.js:95:21 at passBackControl (C:\Users\VAIBHAV\Desktop\GoogleAuth20\node_modules\oauth\lib\oauth2.js:132:9) at IncomingMessage. (C:\Users\VAIBHAV\Desktop\GoogleAuth20\node_modules\oauth\lib\oauth2.js:157:7) at IncomingMessage.emit (node:events:525:35) at endReadableNT (node:internal/streams/readable:1359:12) at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

23c0lvtd

23c0lvtd1#

转到google developer console查找你的项目,在库中搜索People API。
启用它。

相关问题