Skip to content
New issue

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

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

Already on GitHub? # to your account

Add support for OAuth2 state parameter #63

Merged
merged 1 commit into from
Dec 10, 2013
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: 5 additions & 1 deletion flask_oauthlib/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,13 @@ def request(self, url, data=None, headers=None, format='urlencoded',
)
return OAuthResponse(resp, content, self.content_type)

def authorize(self, callback=None):
def authorize(self, callback=None, state=None):
"""
Returns a redirect response to the remote authorization URL with
the signed callback given.

:param state: an optional value to embed in the OAuth request. Use this
if you want to pass around application state (e.g. CSRF tokens).
"""
if self.request_token_url:
token = self.generate_request_token(callback)[0]
Expand All @@ -467,6 +470,7 @@ def authorize(self, callback=None):
self.expand_url(self.authorize_url),
redirect_uri=callback,
scope=scope,
state=state,
**params
)
return redirect(url)
Expand Down