Closed JeffWScott closed 10 years ago
Seems to be somewhat related to oAuth. I am not sure if it's the callback URL tho. But let's try that - you definitely spotted a hole in the docs (thx for pointing it out): In the Github application settings set the callback URL to http://myserver.my.server://3000/auth/github/callback and try again. If that doesn't fix it, we'll dig deeper
I think your instructions are probably great for people that know what's going on. Unfortunately when you post stuff on the internet you get people like me who are just fumbling around trying to get things to work :) If I'm wasting your time just let me know!
"http://myserver.my.server://3000/auth/github/callback" did not work at all, said could not find page.
I changed it to "http://myserver.my.server:3000/auth/github/callback" and I got the same error as before; the 500 error.
Also, a quick question. Does your cloud9hub start-up my cloud9 server? meaning, do I need to startup both your server.js and the server.js in the "c9" directory?
Oh boy the autocorrect fooled me once more.
The fact that the docs need to become more expressive is true. TThat's why I work to improve them :)
Alright so that wasn't the cause for the server error... Give me some time to find other options
It starts cloud9 automatically for you
It could be related to an invalid Client Secret or Client ID.
I'm having the same issue. Exact same error, presumably same setup. My relevant settings in the GitHub Application are:
Homepage URL: http://cloud9.myserver.com:3000 Authorization callback URL: http://cloud9.myserver.com:3000/auth/github/callback
Log output follows (slightly sanitized):
GET /auth/github/callback?code={token} 500 921ms
failed to fetch user profile (status: 401 data: {"message":"Requires authentication","documentation_url":"http://developer.github.com/v3"})
at /var/www/cloud9hub/cloud9hub/node_modules/passport-github/lib/passport-github/strategy.js:90:28
at passBackControl (/var/www/cloud9hub/cloud9hub/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/oauth2.js:109:9)
at IncomingMessage.<anonymous> (/var/www/cloud9hub/cloud9hub/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/oauth2.js:128:7)
at IncomingMessage.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:910:16
at process._tickCallback (node.js:415:13)
SOLVED! It's obvious once you see it, but it's an issue with the config.js. Make sure that you set your exports.PERMITTED_USERS correctly. By default, only GitHub users 'alice' and 'bob' will be able to use your application! Change it thusly:
exports.GITHUB_CLIENT_ID = '{client_id}';
exports.GITHUB_CLIENT_SECRET = '{client_secret}';
// This allows everybody to sign up
//exports.PERMITTED_USERS = false; // comment this line out
// This restricts signup to the users alice and bob:
//exports.PERMITTED_USERS = ['alice', 'bob']; // comment this line out, too
exports.PERMITTED_USERS = ['steathdave'];
exports.BASE_URL = 'http://localhost';
After this change, I am able to log into my application.
@stealthdave Nice catch! I think the permitted users should be commented out by default, only to be enabled when you really want it... I'll change that and make a note in the readme
But wait - it should ignore the permitted users when it's set to false (as is in the default config.js.example)
I followed your instructions but I get this error after going to myserver.my.server:3000 and clicking the "sign in with GitHub" link. Obviously I'm doing something wrong but I can't figure out what.
Express 500 failed to fetch user profile (status: 401 data: {"message":"Requires authentication","documentation_url":"http://developer.github.com/v3"}) at /home/jeff/cloud9/cloud9hub/node_modules/passport-github/lib/passport-github/strategy.js:90:28 at passBackControl (/home/jeff/cloud9/cloud9hub/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/oauth2.js:109:9) at IncomingMessage. (/home/jeff/cloud9/cloud9hub/node_modules/passport-github/node_modules/passport-oauth/node_modules/oauth/lib/oauth2.js:128:7) at IncomingMessage.EventEmitter.emit (events.js:117:20) at _stream_readable.js:920:16 at process._tickCallback (node.js:415:13)
When I setup the app in Github I wasn't sure what to put for "Authorization callback URL" so I put "myserver.my.server".
I don't know a whole lot about oAuth. if this is the issue can you please point me in the right direction?