简体   繁体   English

使用passport和Google API进行身份验证时出现问题 - 正在发生InternalOAuthError

[英]Problems with authentication using passport and google API - InternalOAuthError is occurring

So, I'm having some problems with google authentication and passport. 所以,我在使用谷歌身份验证和护照时遇到了一些问题。

I'm using these configs: 我正在使用这些配置:

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

and also, I have oAuth ID configured in console.developers.google: 另外,我在console.developers.google中配置了oAuth ID:

  • The first config I'm using for localhost server, and works fine 我用于localhost服务器的第一个配置,并且工作正常
  • The second config I'm using a specific server, but is not working. 第二个配置我正在使用特定的服务器,但无法正常工作。 I can see the google page, select and signup with my user, but when a received the callback method ( http://[server]:[port]/ ?code=[...] ) an error has occurred ( InternalOAuthError ). 我可以看到谷歌页面,选择并注册我的用户,但是当收到回调方法( http:// [服务器]:[端口] / ?代码= [...] )时发生错误( InternalOAuthError ) 。

Here is the log: 这是日志:

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)

I'd like to know if someone has the same problem. 我想知道是否有人有同样的问题。

I don't know if this is the same problem you were facing, but I got a very similar error message: 我不知道这是否与您面临的问题相同,但我收到了一条非常相似的错误消息:

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)

In my case the Client ID did not match the Client secret , make sure they are matched from the Google Developer's Console: 在我的情况下, Client IDClient secret不匹配,请确保它们与Google Developer's Console匹配:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用通行证linkedin策略时出现InternalOAuthError - InternalOAuthError when using passport-linkedin strategy InternalOAuthError:无法在nodejs中获取请求令牌passport-google - InternalOAuthError: Failed to obtain request token passport-google in nodejs Passport google login 抛出错误 InternalOAuthError: 无法获取访问令牌 - Passport google login throwing error InternalOAuthError: Failed to obtain access token 使用passport-google-oauth20 InternalOAuthError获取错误:无法获取用户配置文件并且在将标头发送到客户端后无法设置标头 - Getting erros using passport-google-oauth20 InternalOAuthError: Failed to fetch user profile and Cannot set headers after they are sent to the client 使用nodejs护照集成第三方平台时出现InternalOAuthError - InternalOAuthError when using nodejs passport to integration third party platform Google API + Passport + React:身份验证流程 - Google APi + Passport + React : Authentication flow Angular 4和Passport API身份验证 - Angular 4 & Passport API authentication InternalOAuthError:在实施 twitter 策略时无法使用 express 和 passport js 获取用户配置文件 - InternalOAuthError: failed to fetch user profile using express and passport js while implementing twitter strategy 如何使用 mocha 测试带有 Passport Google OAuth 身份验证的 Express REST API? - How to test an Express REST API with Passport Google OAuth authentication with mocha? Passport失败了404 - 对于GitHub的InternalOAuthError为什么? - Passport failing with 404 - InternalOAuthError for GitHub why?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM