onepiecejs / nodejs-cantas

Cantas is a real-time collaborative web application. Official repository
Other
202 stars 134 forks source link

Google Authentication redirects back to login page, cannot log in #69

Closed sgallagher closed 9 years ago

sgallagher commented 9 years ago

I set up a Cantas instance on OpenShift (http://cantas-fedoraserver.rhcloud.com). I enabled Google Authentication (and set up a Client ID for it). When I click "Log in with Google", I am directed to the Google login, then prompted to allow Cantas to see my email address and basic profile information, and when I click "Approve", I'm simply redirected back to the login page again. This is preventing us from deploying Cantas.

xiaods commented 9 years ago

@sgallagher Got it, I will fix it this week.

xiaods commented 9 years ago

by the way, please check cat settings.json

...
"auth": {
        "strategy": "remote_user",
        "google": {
          "clientID": "xxx-xxxx.apps.googleusercontent.com",
          "clientSecret": "xxx",
          "callbackURL": "http://cantas-onepiecejs.rhcloud.com/oauth2callback"
        }
    },
...
sgallagher commented 9 years ago
"auth": {
    "strategy": "remote_user",
    "google": {
        "clientID": "xxx.apps.googleusercontent.com",
        "clientSecret": "xxx",
        "callbackURL": "http://cantas-fedoraserver.rhcloud.com/oauth2callback"
    }
},

I assume that callbackURL is supposed to be pointing at my site, not yours?

xiaods commented 9 years ago

@sgallagher could you please re-check google console settings:

my app address is here: https://console.developers.google.com/project/nodejs-cantas/apiui/credential I think you also have same url to settings.

please check the cantas-fedoraserver app have correct settings: screen shot 2014-12-15 at 11 40 14 pm

sgallagher commented 9 years ago

REDIRECT URIS
http://cantas-fedoraserver.rhcloud.com/oauth2callback

JAVASCRIPT ORIGINS http://cantas-fedoraserver.rhcloud.com

xiaods commented 9 years ago

i can't give you final solution, but i also found some weird thing, when i directly view http://cantas-onepiecejs.rhcloud.com/oauth2callback, i got 400 error, if you use your http://cantas-fedoraserver.rhcloud.com/oauth2callback, i will redirect to http://cantas-fedoraserver.rhcloud.com/login, i am not found the reason, i will check it asap.

sgallagher commented 9 years ago

OK, so that indicates that there's probably a setting I missed somewhere that defines that location.

xiaods commented 9 years ago

@sgallagher please check here: https://github.com/onepiecejs/nodejs-cantas/blob/master/.openshift/lib/init_settings#L84

sgallagher commented 9 years ago

What am I looking for? See https://github.com/onepiecejs/nodejs-cantas/issues/69#issuecomment-67011337 for what I have there...

xiaods commented 9 years ago

feel need patch to update README, the openshift settings maybe overwrite the settings again.

sgallagher commented 9 years ago

I set those values in init_settings which then pushed them to settings.json. Both are in agreement about the Client ID, Client Secret and callbackURL values

xiaods commented 9 years ago

@sgallagher when testing pass, i will merge the patch, it will keep cantas successfully deploy to openshift.