Permalink
Browse files

Merge pull request #573 from ewdurbin/master

Allow 'oob' as a callback_uri per OAuth spec section 2.1
  • Loading branch information...
2 parents 9ddbd7c + ae53615 commit 303e9635936c2aa5535c39c6712be98ded775276 @bdarnell bdarnell committed Jul 31, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 tornado/auth.py
View
@@ -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:
@@ -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))

0 comments on commit 303e963

Please sign in to comment.