簡體   English   中英

Strongloop Passport.js身份驗證-“無法獲取訪問令牌”

[英]Strongloop Passport.js authentication - “Failed to obtain access token”

我正在嘗試編寫一個通過Github Enterprise服務器進行身份驗證的Express / Passport應用。 這需要手動編輯護照的github策略以指向私有企業API端點。 那里沒有大佬。

我正在使用Strongloop來構建應用程序,因此我正在使用strongloop-passport-component集成。

據我所知,該應用程序已正確配置,但是在重定向時,我收到以下錯誤消息:

環回500 InternalOAuthError:無法在/ Users處的Strategy.OAuth2Strategy._createOAuthError(/Users/Tom/Desktop/soundoff/node_modules/passport-github/node_modules/passport-oauth2/lib/strategy.js:370:17)獲取訪問令牌在/Users/Tom/Desktop/soundoff/node_modules/passport-github/lib/strategy.js上的/Tom/Desktop/soundoff/node_modules/passport-github/node_modules/passport-oauth2/lib/strategy.js:166:45: 75:25,位於ClientRequest的/Users/Tom/Desktop/soundoff/node_modules/passport-github/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:177:18。 (/Users/Tom/Desktop/soundoff/node_modules/passport-github/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:148:5),位於ClientRequest的emitOne(events.js:90:13)。在TLSSocket.emit(events.js:182:7)在emitOne(events.js:90:13)在TLSSocket.socketErrorListener(_http_client.js:262:9)處發出(events.js:182:7)

如果我查看github應用程序設置,則可以驗證用戶是否已成功通過該應用程序進行身份驗證。 似乎無法將用戶重定向到重定向URI。 相應地,它找不到訪問令牌?

用戶最終使用的URL類似於http://0.0.0.0:3000/auth/github/callback?code=dceef2ffe07b5dbfa194但是,我希望他們最終使用http://0.0.0.0:3000/auth/account

是什么原因導致環回找不到訪問令牌? 它不是在URL ?code=嗎?

不幸的是,解決方案是不使用strongloop-passport-component。 開發人員反應遲鈍,看起來不會得到解決。

如果臨時令牌(此處為dceef2ffe07b5dbfa194 )無效,則可能無法獲取訪問令牌。

可能是在您修改的github策略中,未正確配置OAuth流的第二階段,在該階段中臨時令牌被交換為最終令牌,很可能是請求主github api而不是您的企業github api進行令牌交換

暫無
暫無

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

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