New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github auth callback url issue #55

Closed
boo1ean opened this Issue Sep 23, 2015 · 22 comments

Comments

Projects
None yet
10 participants
@boo1ean

boo1ean commented Sep 23, 2015

Seems like strider-github doesn't use SERVER_NAME to build github auth callback url.

It always redirects me to localhost.

Bitbucket integration works well though.

@midgethoen

This comment has been minimized.

Show comment
Hide comment
@midgethoen

midgethoen Jan 6, 2016

I have this same issue.. i'm trying to figure out how I am supposed to configure this.

midgethoen commented Jan 6, 2016

I have this same issue.. i'm trying to figure out how I am supposed to configure this.

@knownasilya

This comment has been minimized.

Show comment
Hide comment
@knownasilya

knownasilya Jan 6, 2016

Member

@midgethoen have you updated your github plugin in the Strider "Plugins" page?

Member

knownasilya commented Jan 6, 2016

@midgethoen have you updated your github plugin in the Strider "Plugins" page?

@tomhallam

This comment has been minimized.

Show comment
Hide comment
@tomhallam

tomhallam Jan 12, 2016

Also having this issue

tomhallam commented Jan 12, 2016

Also having this issue

@mastertinner

This comment has been minimized.

Show comment
Hide comment
@mastertinner

mastertinner Jan 14, 2016

Contributor

Same here (using strider 1.7.5 and strider-github 2.1.2)

Contributor

mastertinner commented Jan 14, 2016

Same here (using strider 1.7.5 and strider-github 2.1.2)

@knownasilya

This comment has been minimized.

Show comment
Hide comment
@knownasilya

knownasilya Jan 14, 2016

Member

Found a workaround. Use the following ENVs to configure github:

PLUGIN_GITHUB_APP_ID
PLUGIN_GITHUB_APP_SECRET

Along with SERVER_NAME. Looks like there is a check for plugins, which are
found by the PLUGIN_<pluginname> env prefix and then Github config is fixed. Will look into this some more later.


Hum, you're probably already doing this. When does the callback not work, at what step in Strider?

Member

knownasilya commented Jan 14, 2016

Found a workaround. Use the following ENVs to configure github:

PLUGIN_GITHUB_APP_ID
PLUGIN_GITHUB_APP_SECRET

Along with SERVER_NAME. Looks like there is a check for plugins, which are
found by the PLUGIN_<pluginname> env prefix and then Github config is fixed. Will look into this some more later.


Hum, you're probably already doing this. When does the callback not work, at what step in Strider?

@knownasilya knownasilya self-assigned this Jan 14, 2016

@knownasilya knownasilya added the bug label Jan 14, 2016

@knownasilya

This comment has been minimized.

Show comment
Hide comment
@knownasilya

knownasilya Jan 14, 2016

Member

Could someone post how they start strider, with the envs (you can blank them out if they are sensitive)?

Member

knownasilya commented Jan 14, 2016

Could someone post how they start strider, with the envs (you can blank them out if they are sensitive)?

@mastertinner

This comment has been minimized.

Show comment
Hide comment
@mastertinner

mastertinner Jan 15, 2016

Contributor

export SERVER_NAME = "https://strider.scapp.io"
export DB_URI = [my_mongo_uri]
export SMTP_HOST = "smtp.mailgun.org"
export SMTP_USER = [my_mailgun_username]
export SMTP_PASS = [my_mailgun_password]
NODE_ENV=production npm start

Contributor

mastertinner commented Jan 15, 2016

export SERVER_NAME = "https://strider.scapp.io"
export DB_URI = [my_mongo_uri]
export SMTP_HOST = "smtp.mailgun.org"
export SMTP_USER = [my_mailgun_username]
export SMTP_PASS = [my_mailgun_password]
NODE_ENV=production npm start

@knownasilya

This comment has been minimized.

Show comment
Hide comment
@knownasilya

knownasilya Jan 15, 2016

Member

^ ok yes you are missing the two ENVs for setting up the github plugin, see #55 (comment) and the readme.

Member

knownasilya commented Jan 15, 2016

^ ok yes you are missing the two ENVs for setting up the github plugin, see #55 (comment) and the readme.

@emcniece

This comment has been minimized.

Show comment
Hide comment
@emcniece

emcniece Jan 22, 2016

Hit this while doing some Nginx proxy shenanigans, and exporting SERVER_NAME worked after realizing that it needs to be set to the publicly-facing connection, not the internal one. I wanted to have my Strider instance available on port 80 - probably could just set Strider to export port 80 instead of doing this Nginx stuff...

I am using this upstart script.

server {
    listen 80;
    server_name 123.456.1.2;

    access_log  /var/log/nginx/strider.access.log;
    error_log  /var/log/nginx/strider.error.log;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header HOST $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://123.456.1.2:4000;
        proxy_redirect off;
    }
}

... and the problem was that the upstart script should have exported http://123.456.1.2, without the port.

On a side note, I'm not able to upgrade the system's strider-github package because the strider user doesn't auto-sudo. Weird.

emcniece commented Jan 22, 2016

Hit this while doing some Nginx proxy shenanigans, and exporting SERVER_NAME worked after realizing that it needs to be set to the publicly-facing connection, not the internal one. I wanted to have my Strider instance available on port 80 - probably could just set Strider to export port 80 instead of doing this Nginx stuff...

I am using this upstart script.

server {
    listen 80;
    server_name 123.456.1.2;

    access_log  /var/log/nginx/strider.access.log;
    error_log  /var/log/nginx/strider.error.log;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header HOST $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://123.456.1.2:4000;
        proxy_redirect off;
    }
}

... and the problem was that the upstart script should have exported http://123.456.1.2, without the port.

On a side note, I'm not able to upgrade the system's strider-github package because the strider user doesn't auto-sudo. Weird.

@knownasilya

This comment has been minimized.

Show comment
Hide comment
@knownasilya

knownasilya Jan 25, 2016

Member

@alexfernandez could you put a console.log(rc) here (after the if): https://github.com/Strider-CD/strider/blob/master/lib/libconfig.js#L69 and run the app and post the results (make sure to obscure sensitive info) here.

Member

knownasilya commented Jan 25, 2016

@alexfernandez could you put a console.log(rc) here (after the if): https://github.com/Strider-CD/strider/blob/master/lib/libconfig.js#L69 and run the app and post the results (make sure to obscure sensitive info) here.

@alexfernandez

This comment has been minimized.

Show comment
Hide comment
@alexfernandez

alexfernandez Jan 25, 2016

Contributor

The problem is that Strider is changing the env variable SERVER_NAME to strider_server_name here. I have fixed it with this PR: #59.

Contributor

alexfernandez commented Jan 25, 2016

The problem is that Strider is changing the env variable SERVER_NAME to strider_server_name here. I have fixed it with this PR: #59.

@knownasilya

This comment has been minimized.

Show comment
Hide comment
@knownasilya

knownasilya Jan 25, 2016

Member

That is how rc works, so it shouldn't be a problem. Try master with something like DEBUG=strider:config PLUGIN_GITHUB_TEST=test SERVER_NAME=blah npm start

You should get something like:

{
  "logging": {
    "exitOnError": true,
    "file_enabled": false,
    "console": {
      "level": 0,
      "colorize": true,
      "timestamp": true
    },
    "console_enabled": true
  },
  "viewpath": "/Users/iradchenko/sandbox/strider/lib/views",
  "host": "0.0.0.0",
  "port": 3000,
  "server_name": "blah",
  "db_uri": "mongodb://localhost/strider-foss",
  "smtp_host": "",
  "smtp_port": 587,
  "smtp_user": "",
  "smtp_pass": "",
  "smtp_from": "Strider <noreply@stridercd.com>",
  "enablePty": false,
  "extpath": "node_modules",
  "session_secret": "8L8BudMkqBUqrz",
  "github_app_id": "",
  "github_secret": "",
  "cors": false,
  "body_parser_limit": false,
  "_": [],
  "stubSmtp": true,
  "plugins": {
    "github": {
      "test": "test",
      "hostname": "blah"
    }
  }
Member

knownasilya commented Jan 25, 2016

That is how rc works, so it shouldn't be a problem. Try master with something like DEBUG=strider:config PLUGIN_GITHUB_TEST=test SERVER_NAME=blah npm start

You should get something like:

{
  "logging": {
    "exitOnError": true,
    "file_enabled": false,
    "console": {
      "level": 0,
      "colorize": true,
      "timestamp": true
    },
    "console_enabled": true
  },
  "viewpath": "/Users/iradchenko/sandbox/strider/lib/views",
  "host": "0.0.0.0",
  "port": 3000,
  "server_name": "blah",
  "db_uri": "mongodb://localhost/strider-foss",
  "smtp_host": "",
  "smtp_port": 587,
  "smtp_user": "",
  "smtp_pass": "",
  "smtp_from": "Strider <noreply@stridercd.com>",
  "enablePty": false,
  "extpath": "node_modules",
  "session_secret": "8L8BudMkqBUqrz",
  "github_app_id": "",
  "github_secret": "",
  "cors": false,
  "body_parser_limit": false,
  "_": [],
  "stubSmtp": true,
  "plugins": {
    "github": {
      "test": "test",
      "hostname": "blah"
    }
  }
@alexfernandez

This comment has been minimized.

Show comment
Hide comment
@alexfernandez

alexfernandez Jan 25, 2016

Contributor

You are right, the change referenced above is unnecessary.

The problem was that, if you use a domain different than localhost:3000, you need to add your own developer integration as explained here. Novice error, but it shows as a redirect to http://localhost:3000 since this is the default declared callback URL for the default client ID. Hope this helps someone else.

Contributor

alexfernandez commented Jan 25, 2016

You are right, the change referenced above is unnecessary.

The problem was that, if you use a domain different than localhost:3000, you need to add your own developer integration as explained here. Novice error, but it shows as a redirect to http://localhost:3000 since this is the default declared callback URL for the default client ID. Hope this helps someone else.

@asayuki

This comment has been minimized.

Show comment
Hide comment
@asayuki

asayuki Feb 3, 2016

This is still an issue. I've tried the solution above and it does not work. Still getting localhost:3000 in my callback URL.

asayuki commented Feb 3, 2016

This is still an issue. I've tried the solution above and it does not work. Still getting localhost:3000 in my callback URL.

@knownasilya

This comment has been minimized.

Show comment
Hide comment
@knownasilya

knownasilya Feb 3, 2016

Member

Did you update to 1.7.6?

Member

knownasilya commented Feb 3, 2016

Did you update to 1.7.6?

@asayuki

This comment has been minimized.

Show comment
Hide comment
@asayuki

asayuki Feb 3, 2016

Running 1.7.6 yes.

Bitbucket is working fine, but Github not so much.

asayuki commented Feb 3, 2016

Running 1.7.6 yes.

Bitbucket is working fine, but Github not so much.

@knownasilya

This comment has been minimized.

Show comment
Hide comment
@knownasilya

knownasilya Feb 3, 2016

Member

So I cannot reproduce this issue. I'll try do a fresh setup this weekend. Any help in narrowing down where the issue is, would be very appreciated.

Member

knownasilya commented Feb 3, 2016

So I cannot reproduce this issue. I'll try do a fresh setup this weekend. Any help in narrowing down where the issue is, would be very appreciated.

@asayuki

This comment has been minimized.

Show comment
Hide comment
@asayuki

asayuki Feb 3, 2016

Sorry, I've got it to work now. Misplaced characters in ENV.

By starting the application by using SERVER_NAME=http://my.address PLUGIN_GITHUB_APP_ID=<myAppID> PLUGIN_GITHUB_APP_SECRET=<myAppSecret> node bin/strider I got it to work.

Might be worthwhile to update the README and state that ID and SECRET must be present for it to work, instead of optional.

asayuki commented Feb 3, 2016

Sorry, I've got it to work now. Misplaced characters in ENV.

By starting the application by using SERVER_NAME=http://my.address PLUGIN_GITHUB_APP_ID=<myAppID> PLUGIN_GITHUB_APP_SECRET=<myAppSecret> node bin/strider I got it to work.

Might be worthwhile to update the README and state that ID and SECRET must be present for it to work, instead of optional.

@knownasilya

This comment has been minimized.

Show comment
Hide comment
@knownasilya

knownasilya Feb 3, 2016

Member

The should be optional as of 1.7.6.. will look into that.

Member

knownasilya commented Feb 3, 2016

The should be optional as of 1.7.6.. will look into that.

@midgethoen

This comment has been minimized.

Show comment
Hide comment
@midgethoen

midgethoen Feb 8, 2016

@knownasilya sry, I missed your question and should have updated my question anyway. Yes, I upgraded the github plugi, which -- I believe -- fixed the issue for me.

midgethoen commented Feb 8, 2016

@knownasilya sry, I missed your question and should have updated my question anyway. Yes, I upgraded the github plugi, which -- I believe -- fixed the issue for me.

@JKY

This comment has been minimized.

Show comment
Hide comment
@JKY

JKY commented Jun 19, 2016

@asayuki , it works

@crobinson42

This comment has been minimized.

Show comment
Hide comment
@crobinson42

crobinson42 Jul 30, 2016

FYI - I was running strider 1.7.7 and everything worked fine with the basic env vars (no github_app_id or secret). I ended up reinstalling and got strider v1.8.0 and now it's required that I set github_app_id & github_secret in order for github plugin to work.

crobinson42 commented Jul 30, 2016

FYI - I was running strider 1.7.7 and everything worked fine with the basic env vars (no github_app_id or secret). I ended up reinstalling and got strider v1.8.0 and now it's required that I set github_app_id & github_secret in order for github plugin to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment