Strider-CD / strider-github

Github provider for strider
25 stars 34 forks source link

Failed to obtain access token #45

Closed JaywayCreations closed 9 years ago

JaywayCreations commented 9 years ago

I'm running Strider on port 3000 behind an Apache server (on Mac OS X). I've set the env vars: PLUGIN_GITHUB_APP_ID, PLUGIN_GITHUB_APP_SECRET, SERVER_NAME and URL prior to launching Strider. When I authorize my app at GitHub it hangs for almost a minute and tries to load this URL: http://myserver.com/auth/github/callback?code=xxxyyy

Then I get this message:

500 InternalOAuthError: Failed to obtain access token
   at Strategy.OAuth2Strategy._createOAuthError (/usr/local/lib/node_modules/strider/node_modules/strider-github/node_modules/passport-github/node_modules/passport-oauth2/lib/strategy.js:348:17)
   at /usr/local/lib/node_modules/strider/node_modules/strider-github/node_modules/passport-github/node_modules/passport-oauth2/lib/strategy.js:171:43
   at /usr/local/lib/node_modules/strider/node_modules/strider-github/node_modules/passport-github/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:176:18
   at ClientRequest.<anonymous> (/usr/local/lib/node_modules/strider/node_modules/strider-github/node_modules/passport-github/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:147: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:950:16
   at process._tickCallback (node.js:355:11)

Any idea what's wrong?

knownasilya commented 9 years ago

Is your server exposed to the world? Seems like Github is trying to auth, but cannot reach your Strider instance, so Strider times out after some time. Make sure strider has been exposed to the world.

ciryon commented 9 years ago

Yes, it's exposed to the world and it seems GitHub reaches the server as I get the error message in the Strider server log.

(that's me posting the issue above, was logged in to another account :) )

knownasilya commented 9 years ago

But that error doesn't mean that Github was able to hit that url, it just means it didn't get anything, especially since it took some time..

ciryon commented 9 years ago

Ok, it really does seem the server is accessible from world. Tried from another remote machine. The URL from GitHub looks like this: https://github.com/login/oauth/authorize?response_type=code&redirect_uri=http%3A%2F%2Fmyserver.com%2Fauth%2Fgithub%2Fcallback&scope=repo&client_id=abc123 and after a while redirects (?) into my callback URL.

The client ID matches with what I have in PLUGIN_GITHUB_APP_ID.

knownasilya commented 9 years ago

So put a console log or a debugger here: https://github.com/Strider-CD/strider-github/blob/master/lib/webapp.js#L134 and you'll know if it hits it. Most likely it isn't, even if Github calls the url. I'd check your Apache logs to make sure it went through.

ciryon commented 9 years ago

Ok, after further investigation it turned out that the server had bad DNS servers configured. After correction Strider can successfully connect with GitHub and the list of repos is displayed. Now I get a 404 when attempting to setup a repo, but I'll dig deeper into that and create a seperate issue if needed. My apologies.

knownasilya commented 9 years ago

Thanks for following up.