pallets-eco / flask-social

OAuth Provider Integration for Flask-Security
MIT License
245 stars 103 forks source link

using SOCIAL_APP_URL to provide a proper callback url #41

Open ryanolson opened 10 years ago

ryanolson commented 10 years ago

I ran in to the problem of the callback URLs having localhost:5000 (request.url_root[:-1]) in them. Without having to use Flask's SERVER_NAME option, I decided to using the SOCIAL_APP_URL variable that was added to the app.config by default and not seemingly used anywhere else. I like the idea of using SOCIAL_APP_URL over SERVER_NAME since only the callbacks need full urls.

I changed the behavior such that SOCIAL_APP_URL defaults to None. Thus, if not SOCIA_APP_URL is given, then request.url_root[:-1] is used for generating the callback urls.

eriktaubeneck commented 10 years ago

Hmm, have you tried using SOCIAL_APP_URL: http://localhost:5000 in app.yml for your development settings? I have that, along with the settings on the social end (i.e. on Facebook and Twitter) set to http://localhost:5000 without any issue.

ryanolson commented 10 years ago

Does http://localhost:5000 work for you when you are behind an nginx reverse proxy?

eriktaubeneck commented 10 years ago

I only use localhost with the built in Flask web server for local development. Anytime I've used it with nginx has been on a server bound to port 80, in which case the port won't matter in the URL.