redirect_uri for Oauth2 (google) and reverse proxy

1,030 views
Skip to first unread message

Christophe

unread,
Feb 20, 2014, 12:13:42 PM2/20/14
to secure...@googlegroups.com

Hi,

I have a play application set-up behind a reverse proxy. https://myappurl is proxy-passed to localhost:9xxx where the app server is running.
I am currently implementing Google login with SecureSocial and it does not work when testing behind the reverse proxy.

1) I go to https://myappurl and login
2) I am correctly redirected to google
3) when logging in, Google redirects me to http://localhost:9xxx which obviously does not work

This is because the Oauth request is done with &redirect_uri=http%3A%2F%2Flocalhost%3A9xxx%2Fauthenticate%2Fgoogle

I did not manage to configure SecureSocial to actually redirect to the proxy-passed URI.

I looked into Github and found this commit: https://github.com/jaliss/securesocial/commit/6c8f13921570d6e30292b1e89b587db4d5dbfb92  Is it the purpose of redirectTo parameter? If yes, then I did not manage to use it (I have added this parameter in the securesocial.conf google provider:

    google {
        authorizationUrl="https://accounts.google.com/o/oauth2/auth"
        accessTokenUrl="https://accounts.google.com/o/oauth2/token"
        clientId=xxx
        clientSecret=xxx
        scope="https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email"
        redirectTo="https://myurl/"
    }

It did not change anything.


Anyone has any idea if what I want to do is possible?


Thanks
Christophe
Message has been deleted

Jorge Aliss

unread,
Feb 20, 2014, 12:44:23 PM2/20/14
to secure...@googlegroups.com
Hi Chistophe,

Is XForwardedSupport configured in your proxy? 

Jorge

Christophe Mosa

unread,
Feb 21, 2014, 2:43:11 AM2/21/14
to secure...@googlegroups.com
Hi Jorge,

Thank you for your fast answer. It pointed me into the right direction, the headers were correctly setup in the proxy (nginx here) but I had an "upstream" directive in the vhost configuration which was apparently modifying something in the request. I removed the upstream configuration as I don't need it and put directly 127.0.0.1 in the proxy_pass directive and now it works perfectly.

Thank you again !
Christophe

Jorge Aliss

unread,
Feb 21, 2014, 7:58:30 AM2/21/14
to secure...@googlegroups.com
You're welcome!
Reply all
Reply to author
Forward
0 new messages