簡體   English   中英

使用passport和Google API進行身份驗證時出現問題 - 正在發生InternalOAuthError

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

所以,我在使用谷歌身份驗證和護照時遇到了一些問題。

我正在使用這些配置:

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

另外,我在console.developers.google中配置了oAuth ID:

  • 我用於localhost服務器的第一個配置,並且工作正常
  • 第二個配置我正在使用特定的服務器,但無法正常工作。 我可以看到谷歌頁面,選擇並注冊我的用戶,但是當收到回調方法( 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 Developer's Console匹配:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM