Skip to content

Set 'redirect_uri' with app config callback URL #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Sep 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions flask_oauthlib/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,6 @@ def authorize(self, callback=None, state=None, **kwargs):
# state can be function for generate a random string
state = state()

session['%s_oauthredir' % self.name] = callback
url = client.prepare_request_uri(
self.expand_url(self.authorize_url),
redirect_uri=callback,
Expand Down Expand Up @@ -623,12 +622,11 @@ def handle_oauth1_response(self):

def handle_oauth2_response(self):
"""Handles an oauth2 authorization response."""

client = self.make_client()
remote_args = {
'code': request.args.get('code'),
'client_secret': self.consumer_secret,
'redirect_uri': session.get('%s_oauthredir' % self.name)
'redirect_uri': current_app.config['OAUTH_CALLBACK_URL']
}
log.debug('Prepare oauth2 remote args %r', remote_args)
remote_args.update(self.access_token_params)
Expand Down Expand Up @@ -656,7 +654,6 @@ def handle_oauth2_response(self):
'Unsupported access_token_method: %s' %
self.access_token_method
)

data = parse_response(resp, content, content_type=self.content_type)
if resp.code not in (200, 201):
raise OAuthException(
Expand All @@ -680,7 +677,6 @@ def authorized_response(self):

# free request token
session.pop('%s_oauthtok' % self.name, None)
session.pop('%s_oauthredir' % self.name, None)
return data

def authorized_handler(self, f):
Expand Down