dtauerbach / apollo

Apollo Project website
1 stars 0 forks source link

Fix routing and social login #59

Closed dtauerbach closed 10 years ago

dtauerbach commented 10 years ago

Right now social login is broken for me both locally in the develop branch and on the DigitalOcean test server. The problem, it seems, is that the Flask code in auth.py uses "url_for" for redirects, which redirects internally to the Flask server. This won't work for social login -- we can't redirect people to "localhost:5000/api/facebook_login_callback".

Instead, I think the cleanest solution is to just use explicit routes instead of url_for. @TizianoPerrucci @julesbou Is there any way to share these routes between the front-end and the server code so that we don't have to hard code them? I'll start with the hard code way in dan/fix-develop-auth.

(Also, for reference, another solution I explored was to use SERVER_NAME in server/src/config.py, and specify the relevant domain e.g. "local.apollo.com". But then this server does not seem to listen on localhost:5000 so the proxy passthrough from nginx doesn't seem to work. It seems solution would only work if nginx and the flask server both listen on local.apollo.com, but that seems dangerous and bad. Else Flask could listen on api.apollo.com or something but the functionality we really want is for Flask to be able to redirect people back to the main app so this doesn't help.)

TizianoPerrucci commented 10 years ago

This has been fixed as well.

We made sure that the host header gets propagated to Flask (nginx takes care of that) and in Flask the url_for() return the correct base url.