【问题标题】:Passport integration issue护照整合问题
【发布时间】:2017-05-29 04:05:08
【问题描述】:

有人可以帮忙吗, 我正在尝试使用此模块 (https://github.com/jaredhanson/passport-instagram) 将使用 Instagram 的签名/注册添加到我的 angular-fullstack (https://github.com/angular-fullstack/generator-angular-fullstack) 应用程序,但尝试通过 gulp serve 运行应用程序时出现以下错误。

这个错误现在对我来说是一个障碍,因为我花了很长时间在网上搜索有关如何调试问题的任何可能的提示,但到目前为止还没有运气,有人可以慷慨吗足以给我一些指导,可能是什么问题或如何解决这个问题......?

注意:我的应用程序通过我的代码中的配置文件传递 clientID 和密钥。 (服务器 > 配置 > 环境 > index.js)。 此配置文件适用于 Google 和 Facebook 社交注册/登录。

instagram: {
    clientID: process.env.INSTAGRAM_ID || 'instagram client id goes here',
    clientSecret: process.env.INSTAGRAM_SECRET || 'instagram secret goes here',
    callbackURL: `${process.env.DOMAIN || ''}/auth/instagram/callback`
}

错误是:

/myapp/node_modules/passport-oauth2/lib/strategy.js:82
      if (!options.clientID) { throw new TypeError('OAuth2Strategy requires a clientID option'); }
                                     ^
TypeError: OAuth2Strategy requires a clientID option
        at Strategy.OAuth2Strategy (/myapp/node_modules/passport-oauth2/lib/strategy.js:82:34)
        at new Strategy (/myapp/node_modules/passport-instagram/lib/strategy.js:48:18)
        at Object.setup (/myapp/server/auth/instagram/passport.js:5:16)
        at Object.<anonymous> (/myapp/server/auth/index.js:11:33)
        at Module._compile (module.js:570:32)
        at loader (/myapp/node_modules/babel-register/lib/node.js:144:5)
        at Object.require.extensions.(anonymous function) [as .js] (/myapp/node_modules/babel-register/lib/node.js:154:7)
        at Module.load (module.js:487:32)
        at tryModuleLoad (module.js:446:12)
        at Function.Module._load (module.js:438:3)
        at Module.require (module.js:497:17)
        at require (internal/module.js:20:19)
        at Object.exports.default (/myapp/server/routes.js:15:20)
        at Object.<anonymous> (/myapp/server/app.js:34:1)
        at Module._compile (module.js:570:32)
        at loader (/myapp/node_modules/babel-register/lib/node.js:144:5)
        at Object.require.extensions.(anonymous function) [as .js] (/myapp/node_modules/babel-register/lib/node.js:154:7)
        at Module.load (module.js:487:32)
        at tryModuleLoad (module.js:446:12)
        at Function.Module._load (module.js:438:3)
        at Module.require (module.js:497:17)
        at require (internal/module.js:20:19)
        at Object.<anonymous> (/myapp/server/index.js:12:28)
        at Module._compile (module.js:570:32)
        at Object.Module._extensions..js (module.js:579:10)
        at Module.load (module.js:487:32)
        at tryModuleLoad (module.js:446:12)
        at Function.Module._load (module.js:438:3)
        [nodemon] app crashed - waiting for file changes before starting...

感谢您的帮助。

【问题讨论】:

  • 我找到了一个非常简单的解决方案,直接通过 facebook JDK github.com/amitgoel1287/angular2-facebook 您只需在 index.html 中添加 facebook SDK,然后,您只需复制并粘贴几行代码即可。我知道这行得通...

标签: javascript angularjs angular-fullstack passport.js passport-facebook


【解决方案1】:

我也面临这个问题,并通过提供以下密钥解决了我的问题:

  1. Google 客户端 ID
  2. Google 客户端密码

注意:我使用 Google+ API 进行 OAuth 进行身份验证

【讨论】:

    猜你喜欢
    • 2017-02-20
    • 2019-05-23
    • 2015-05-05
    • 1970-01-01
    • 2015-03-20
    • 2019-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多