使用护照和谷歌API进行身份validation的问题 – InternalOAuthError正在发生

所以,我在使用Google身份validation和护照时遇到了一些问题。

我正在使用这些configuration:

  • “护照”:“^ 0.2.2”
  • “passport-google-oauth2”:“^ 0.1.6”

还有,我在console.developers.google中configuration了oAuth ID:

  • 我用于本地主机服务器的第一个configuration,工作正常
  • 第二个configuration我正在使用特定的服务器,但不工作。 我可以看到谷歌页面,select并注册用户,但是当收到callback方法( http:// [服务器]:[端口] / ?代码= […] )发生错误( InternalOAuthError ) 。

这里是日志:

InternalOAuthError: Failed to obtain access token at Strategy.OAuth2Strategy._createOAuthError ([...]/server/node_modules/passport-google-oauth2/node_modules/passport-oauth2/lib/strategy.js:348:17) at [...]/server/node_modules/passport-google-oauth2/node_modules/passport-oauth2/lib/strategy.js:171:43 at [...]/server/node_modules/passport-google-oauth2/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:177:18 at ClientRequest.<anonymous> ([...]/server/node_modules/passport-google-oauth2/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:148:5) at ClientRequest.emit (events.js:107:17) at TLSSocket.socketErrorListener (_http_client.js:271:9) at TLSSocket.emit (events.js:129:20) at net.js:459:14 at process._tickDomainCallback (node.js:381:11) 

我想知道是否有人有同样的问题。

我不知道这是否是你面对的同样的问题,但我得到了一个非常类似的错误信息:

 InternalOAuthError: failed to obtain access token at /app/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth2.js:125:38 at /app/node_modules/oauth/lib/oauth2.js:177:18 at passBackControl (/app/node_modules/oauth/lib/oauth2.js:123:9) at IncomingMessage.<anonymous> (/app/node_modules/oauth/lib/oauth2.js:143:7) at emitNone (events.js:85:20) at IncomingMessage.emit (events.js:179:7) at endReadableNT (_stream_readable.js:913:12) at _combinedTickCallback (internal/process/next_tick.js:74:11) at process._tickCallback (internal/process/next_tick.js:98:9) 

在我的情况下, Client IDClient secret不匹配,请确保它们是从Google开发者控制台中匹配的:

https://console.developers.google.com/apis/credentials/oauthclient/