Skip to content

Commit

Permalink
auth: Fix example code
Browse files Browse the repository at this point in the history
Continuation of tornadoweb#2811

The oauth2 version of authorize_redirect is no longer a coroutine, so
don't use await in example code. The oauth1 version is still a
coroutine, but one twitter example was incorrectly calling it with
yield instead of await.
  • Loading branch information
bdarnell authored and jeyrce committed Aug 25, 2021
1 parent 0098eaa commit 0399545
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tornado/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ async def get(self):
if not new_entry:
# Call failed; perhaps missing permission?
await self.authorize_redirect()
self.authorize_redirect()
return
self.finish("Posted a message!")
Expand Down Expand Up @@ -772,7 +772,7 @@ async def get(self):
access_token=self.current_user["access_token"])
if not new_entry:
# Call failed; perhaps missing permission?
yield self.authorize_redirect()
await self.authorize_redirect()
return
self.finish("Posted a message!")
Expand Down Expand Up @@ -954,7 +954,7 @@ async def get(self):
code=self.get_argument("code"))
# Save the user with e.g. set_secure_cookie
else:
await self.authorize_redirect(
self.authorize_redirect(
redirect_uri='/auth/facebookgraph/',
client_id=self.settings["facebook_api_key"],
extra_params={"scope": "read_stream,offline_access"})
Expand Down Expand Up @@ -1072,7 +1072,7 @@ async def get(self):
if not new_entry:
# Call failed; perhaps missing permission?
yield self.authorize_redirect()
self.authorize_redirect()
return
self.finish("Posted a message!")
Expand Down

0 comments on commit 0399545

Please sign in to comment.