I'm trying to write an Express/Passport app that authenticates with a Github Enterprise server. This has required manually-editing the github-strategy for passport to point to the private enterprise API endpoints. No biggie there.
I'm using Strongloop to build the application, so I'm using the strongloop-passport-component
integration.
As far as I can tell the app is configured properly, but on redirect, I get the following error message:
Loopback 500 InternalOAuthError: Failed to obtain access token at Strategy.OAuth2Strategy._createOAuthError (/Users/Tom/Desktop/soundoff/node_modules/passport-github/node_modules/passport-oauth2/lib/strategy.js:370:17) at /Users/Tom/Desktop/soundoff/node_modules/passport-github/node_modules/passport-oauth2/lib/strategy.js:166:45 at /Users/Tom/Desktop/soundoff/node_modules/passport-github/lib/strategy.js:75:25 at /Users/Tom/Desktop/soundoff/node_modules/passport-github/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:177:18 at ClientRequest. (/Users/Tom/Desktop/soundoff/node_modules/passport-github/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:148:5) at emitOne (events.js:90:13) at ClientRequest.emit (events.js:182:7) at TLSSocket.socketErrorListener (_http_client.js:262:9) at emitOne (events.js:90:13) at TLSSocket.emit (events.js:182:7)
If I look at the github app settings, I can verify that the user successfully authenticated with the app. It just seems to fail to redirect the user to the redirect URI. aparrently it cannot find the access token?
The URL the user ends up on is something like http://0.0.0.0:3000/auth/github/callback?code=dceef2ffe07b5dbfa194
-- however, I expect them to end up on http://0.0.0.0:3000/auth/account
.
What could be causing Loopback to not find the access token? Isn't it in the url ?code=
?