From 4918dfc64768687b6e53dcacaaa241449a3bc428 Mon Sep 17 00:00:00 2001 From: Ryan Olson Date: Tue, 25 Mar 2014 14:37:22 -0600 Subject: [PATCH] using SOCIAL_APP_URL to provide a proper callback url for applications behind an proxy --- flask_social/core.py | 2 +- flask_social/utils.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/flask_social/core.py b/flask_social/core.py index 748323c..c182d42 100644 --- a/flask_social/core.py +++ b/flask_social/core.py @@ -33,7 +33,7 @@ 'SOCIAL_CONNECT_DENY_VIEW': '/', 'SOCIAL_POST_OAUTH_CONNECT_SESSION_KEY': 'post_oauth_connect_url', 'SOCIAL_POST_OAUTH_LOGIN_SESSION_KEY': 'post_oauth_login_url', - 'SOCIAL_APP_URL': 'http://localhost' + 'SOCIAL_APP_URL': None, } diff --git a/flask_social/utils.py b/flask_social/utils.py index 45c0609..91af2c0 100644 --- a/flask_social/utils.py +++ b/flask_social/utils.py @@ -32,9 +32,10 @@ def get_authorize_callback(endpoint, provider_id): param: endpoint: Absolute path to append to the application's host """ + url_root = current_app.config['SOCIAL_APP_URL'] or request.url_root[:-1] endpoint_prefix = config_value('BLUEPRINT_NAME') url = url_for(endpoint_prefix + '.' + endpoint, provider_id=provider_id) - return request.url_root[:-1] + url + return url_root + url def get_connection_values_from_oauth_response(provider, oauth_response):