GooglePlusAPI返回错误“项目中尚未使用传统人API”

时间:2019-11-01 14:54:45

标签: oauth-2.0 passport.js google-oauth

我正在尝试使用护照的Google auth2。但是,发生了错误。

GooglePlusAPI错误:传统的人API尚未在项目556727539509中使用,或者已被禁用。通过visiting启用它,然后重试。如果您最近启用了此API,请等待几分钟,以便该操作传播到我们的系统并重试。     在C:\ Users \ rosic \ Documents \ desafio \ oauth-playlist-lesson-9 \ node_modules \ passport-google-oauth20 \ lib \ strategy.js:95:21     在passBackControl(C:\ Users \ rosic \ Documents \ desafio \ oauth-playlist-lesson-9 \ node_modules \ oauth \ lib \ oauth2.js:132:9)     在IncomingMessage。 (C:\ Users \ rosic \ Documents \ desafio \ oauth-playlist-lesson-9 \ node_modules \ oauth \ lib \ oauth2.js:157:7)     在IncomingMessage.emit(events.js:215:7)     在endReadableNT(_stream_visible.js:1183:12)     在processTicksAndRejections(internal / process / task_queues.js:80:21)

const passport = require('passport');
const GoogleStrategy = require('passport-google-oauth20').Strategy;
const keys = require('./keys');

passport.use(
    new GoogleStrategy({
        // options for google strategy
        clientID: keys.google.clientID,
        clientSecret: keys.google.clientSecret,
        callbackURL: '/auth/google/redirect'
    }, (accessToken, refreshToken, profile, done) => {
        // passport callback function
        console.log('passport callback ');
        console.log(profile);
    })
);

1 个答案:

答案 0 :(得分:0)

您需要安装/升级到护照的最新版本,passport-google-oauth20