Skip to content

Commit

Permalink
Merge pull request tornadoweb#573 from ewdurbin/master
Browse files Browse the repository at this point in the history
Allow 'oob' as a callback_uri per OAuth spec section 2.1
  • Loading branch information
bdarnell committed Jul 31, 2012
2 parents 9ddbd7c + ae53615 commit 303e963
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tornado/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,9 @@ def _oauth_request_token_url(self, callback_uri=None, extra_params=None):
oauth_version=getattr(self, "_OAUTH_VERSION", "1.0a"),
)
if getattr(self, "_OAUTH_VERSION", "1.0a") == "1.0a":
if callback_uri:
if callback_uri == "oob":
args["oauth_callback"] = "oob"
elif callback_uri:
args["oauth_callback"] = urlparse.urljoin(
self.request.full_url(), callback_uri)
if extra_params:
Expand All @@ -309,7 +311,10 @@ def _on_request_token(self, authorize_url, callback_uri, response):
base64.b64encode(request_token["secret"]))
self.set_cookie("_oauth_request_token", data)
args = dict(oauth_token=request_token["key"])
if callback_uri:
if callback_uri == "oob":
self.finish(authorize_url + "?" + urllib.urlencode(args))
return
elif callback_uri:
args["oauth_callback"] = urlparse.urljoin(
self.request.full_url(), callback_uri)
self.redirect(authorize_url + "?" + urllib.urlencode(args))
Expand Down

0 comments on commit 303e963

Please sign in to comment.