Strider-CD / strider-github

Github provider for strider
25 stars 34 forks source link

Env variables needed to configure #22

Closed knownasilya closed 9 years ago

knownasilya commented 9 years ago

So I'm trying to get my github setup working, but I think I had my base url misconfigured before. So now I revoked the permissions and set the right base url, but it still looks for the localhost base for the github callback url.

Are there any ENV variables for this plugin, would love a list so we can add to the readme.

niallo commented 9 years ago

Yes, it needs to be configured with the correct oauth app id and oauth app secret. See: https://github.com/Strider-CD/strider-github/blob/master/lib/webapp.js#L59

You'll also need to set the server name of course!

On Thu, Oct 9, 2014 at 10:30 AM, Ilya Radchenko notifications@github.com wrote:

So I'm trying to get my github setup working, but I think I had my base url misconfigured before. So now I revoked the permissions and set the right base url, but it still looks for the localhost base for the github callback url.

Are there any ENV variables for this plugin, would love a list so we can add to the readme.

— Reply to this email directly or view it on GitHub https://github.com/Strider-CD/strider-github/issues/22.

Niall O'Higgins W: http://niallohiggins.com E: n@niallo.me T: @niallohiggins

knownasilya commented 9 years ago

@niallo what are the env vars for those? Is there some kind of standard?

jaredly commented 9 years ago

@knownasilya just updated the readme https://github.com/Strider-CD/strider-github/blob/master/Readme.md

knownasilya commented 9 years ago

@jaredly thanks! What's 'uncluding' in the last sentence? Typo or on purpose?

jaredly commented 9 years ago

good catch :) I make up words all the time

knownasilya commented 9 years ago

Hum, another error:

Cannot GET /auth/github/callback?error=redirect_uri_mismatch&error_description=The+redirect_uri+MUST+match+the+registered+callback+URL+for+this+application.&error_uri=https%3A%2F%2Fdeveloper.github.com%2Fv3%2Foauth%2F%23redirect-uri-mismatch

When I click 'Add Github'

knownasilya commented 9 years ago

Ok I had plugin_github_hostname, changed to strider_github_hostname, and now get: http://localhost:3000/auth/github/callback?code=b0520655490c9ad1141d which is wrong..

niallo commented 9 years ago

You need to set both host name parameters. I always thought the github plugin should just use the main one but such is life :-/

On Thu, Oct 9, 2014 at 10:45 AM, Ilya Radchenko notifications@github.com wrote:

Ok I had plugin_github_hostname, changed to strider_github_hostname, and now get: http://localhost:3000/auth/github/callback?code=b0520655490c9ad1141d which is wrong..

— Reply to this email directly or view it on GitHub https://github.com/Strider-CD/strider-github/issues/22#issuecomment-58548458 .

Niall O'Higgins W: http://niallohiggins.com E: n@niallo.me T: @niallohiggins

knownasilya commented 9 years ago

@niallo so strider_github_hostname AND plugin_github_hostname?

So with both set, it goes here:

http://localhost:3000/auth/github/callback?error=redirect_uri_mismatch&error_description=The+redirect_uri+MUST+match+the+registered+callback+URL+for+this+application.&error_uri=https%3A%2F%2Fdeveloper.github.com%2Fv3%2Foauth%2F%23redirect-uri-mismatch

jaredly commented 9 years ago

no that's strider_hostname. @niallo I'm not opposed to that, and I can't think of a reason not to change it

knownasilya commented 9 years ago

Maybe cause I'm doing all caps? Were they changed to lowercase?

knownasilya commented 9 years ago

Maybe the plugin never receives a config? https://github.com/Strider-CD/strider-github/blob/master/lib/webapp.js#L9

knownasilya commented 9 years ago

So @jaredly I ran STRIDER_HOSTNAME=blah STRIDER_GITHUB_HOSTNAME=blah node debugwhich strider`` with a debugger on line 60, and it's never overwritten.

niallo commented 9 years ago

plugin_github_hostname iirc

On Thursday, October 9, 2014, Ilya Radchenko notifications@github.com wrote:

So @jaredly https://github.com/jaredly I ran STRIDER_HOSTNAME=blah STRIDER_GITHUB_HOSTNAME=blah node which strider with a debugger on that line, and it's never overwritten.

— Reply to this email directly or view it on GitHub https://github.com/Strider-CD/strider-github/issues/22#issuecomment-58554210 .

Niall O'Higgins W: http://niallohiggins.com E: n@niallo.me T: @niallohiggins

knownasilya commented 9 years ago

@niallo nope, same The+redirect_uri+MUST error..

Trying all three now.. nope, no luck same error..

niallo commented 9 years ago

STRIDER_PLUGIN_GITHUB_HOSTNAME maybe? I agree this is getting silly...

knownasilya commented 9 years ago

So strider_github_hostname and strider_hostname let me go to github, but when I accept it tries to go back to localhost:3000... so I think those are good, but the callback url isn't overridden.

knownasilya commented 9 years ago

https://github.com/Strider-CD/strider/blob/1.5.0/main.js#L48

Looks like we only pass one argument.. https://github.com/Strider-CD/strider/blob/1.5.0/bin/strider#L238

knownasilya commented 9 years ago

Or this: https://github.com/Strider-CD/strider/blob/1.5.0/lib/libconfig.js#L65

jaredly commented 9 years ago

Have you created a new github OAuth app? https://github.com/settings/applications/new

knownasilya commented 9 years ago

@jaredly I tried, but it was the same, maybe I'll do it again. What does the callback url need to be, just the base?

knownasilya commented 9 years ago

I see no reason why strider can't register itself with the right settings..

jaredly commented 9 years ago

OAuth registration is a pretty high level of privelege; I don't know that there's an API for that

jaredly commented 9 years ago

example callback url: https://strider-beta.herokuapp.com/ext/github/oauth/callback

jaredly commented 9 years ago

sorry the docs missed that

knownasilya commented 9 years ago

@jaredly close, http://myurl.tld/ext/github/oauth/callback/?error=redirect_uri_mismatch&error_description=The+redirect_uri+MUST+match+the+registered+callback+URL+for+this+application.&error_uri=https%3A%2F%2Fdeveloper.github.com%2Fv3%2Foauth%2F%23redirect-uri-mismatch

knownasilya commented 9 years ago

So the callback is http://mydomain.tld/auth/github/callback and it works.

So this has to be done for every github user you add? Seems excessive.

jaredly commented 9 years ago

not every github user. Just the person setting up the strider instance. You are then the "owner" of the github OAuth app. People using the strider instance can oauth without trouble

knownasilya commented 9 years ago

Ah, ok. Well the following env's worked for me:

knownasilya commented 9 years ago

@jaredly probably worthwhile releasing a new minor version.

jaredly commented 9 years ago

Good call. @niallo looks like I don't have npm permissions for strider-github. I just bumped the version on master

niallo commented 9 years ago

thanks I'll publish later when I get home. cheers!

On Thursday, October 9, 2014, Jared Forsyth notifications@github.com wrote:

Good call. @niallo https://github.com/niallo looks like I don't have npm permissions for strider-github. I just bumped the version on master

— Reply to this email directly or view it on GitHub https://github.com/Strider-CD/strider-github/issues/22#issuecomment-58597050 .

Niall O'Higgins W: http://niallohiggins.com E: n@niallo.me T: @niallohiggins

knownasilya commented 9 years ago

@jaredly how come the bumped changes aren't on master?

niallo commented 9 years ago

published as 1.2.3

knownasilya commented 9 years ago

@niallo should have been 1.3 since the enterprise features are there too.

niallo commented 9 years ago

Ok, published as 1.3.0 and also changed description of package to mention GH enterprise.

On Fri, Oct 10, 2014 at 8:36 AM, Ilya Radchenko notifications@github.com wrote:

@niallo https://github.com/niallo should have been 1.3 since the enterprise features are there too.

— Reply to this email directly or view it on GitHub https://github.com/Strider-CD/strider-github/issues/22#issuecomment-58672929 .

Niall O'Higgins W: http://niallohiggins.com E: n@niallo.me T: @niallohiggins

meticulo3366 commented 9 years ago

I still appear to be having some issues using strider-github on NPM install, running make i notice this issue for test

ubuntu@ip-172-31-21-124:/usr/lib/node_modules/strider/node_modules/strider-github$ sudo make ERROR: Can't open *.js

github api getFile ✓ should get a file (54ms) ✓ should get @ a ref createHooks 1) should fail on bad credentials

make: *\ [test-only] Error 1

meticulo3366 commented 9 years ago

this origin issue to the above massage is this:

GET /auth/github 302 4ms - 0b 13 Oct 00:43:35 - error: TypeError: Cannot read property '0' of undefined at makeAccount (/usr/lib/node_modules/strider/node_modules/strider-github/lib/webapp.js:167:28) at Strategy.validateAuth as _verify at /usr/lib/node_modules/strider/node_modules/strider-github/node_modules/passport-github/node_modules/passport-oauth2/lib/strategy.js:188:22 at /usr/lib/node_modules/strider/node_modules/strider-github/node_modules/passport-github/lib/strategy.js:109:5 at passBackControl (/usr/lib/node_modules/strider/node_modules/strider-github/node_modules/passport-github/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:126:9) at IncomingMessage. (/usr/lib/node_modules/strider/node_modules/strider-github/node_modules/passport-github/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:143:7) at IncomingMessage.emit (events.js:117:20) at _stream_readable.js:943:16 at process._tickCallback (node.js:419:13)

meticulo3366 commented 9 years ago

I hacked the issue by hand coding in my email at /usr/lib/node_modules/strider/node_modules/strider-github/lib/webapp.js:167

knownasilya commented 9 years ago

Did you have an email setup on your github account? On Oct 12, 2014 8:49 PM, "Zeke Dean" notifications@github.com wrote:

I solved the issue by hand coding in my email at /usr/lib/node_modules/strider/node_modules/strider-github/lib/webapp.js:167

— Reply to this email directly or view it on GitHub https://github.com/Strider-CD/strider-github/issues/22#issuecomment-58831681 .