首页 > 解决方案 > 带有 google-outh 策略的护照

问题描述

每当我调用 API URL 时,我正在创建用于使用 google 登录和使用 facebook 登录的 API 我收到错误: “TypeError:OAuth2Strategy 需要验证回调”

我正在使用本地服务器进行测试,这是我用 node.js 实现 google-outh-strategy 的代码

      clientID: "clientId",
      clientSecret: "clientsecret",
      callbackURL: "http://localhost:3001/",
     passReqToCallback: true
    },
      function (request, accessToken, refreshToken, profile, done) {
        console.log(refreshToken);
        console.log(accessToken);
        console.log(profile);
        done(null, profile)
      }
    ));

Here is my references Docs for it :
http://www.passportjs.org/packages/passport-google-oauth2/

标签: passport.js

解决方案


推荐阅读