]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
auth: Use a setting for facebook redirect url
authorBen Darnell <ben@bendarnell.com>
Sat, 8 Jul 2023 00:09:36 +0000 (20:09 -0400)
committerBen Darnell <ben@bendarnell.com>
Sat, 8 Jul 2023 00:38:00 +0000 (20:38 -0400)
Matches a change made to the Google auth mixin in a previous commit.

Fixes #756

tornado/auth.py

index 1312f29909cc399a2adfe65fd9d2b1ac01faf118..e223973707cd054d8a4fee590458b824c9b25f80 100644 (file)
@@ -997,16 +997,19 @@ class FacebookGraphMixin(OAuth2Mixin):
             class FacebookGraphLoginHandler(tornado.web.RequestHandler,
                                             tornado.auth.FacebookGraphMixin):
               async def get(self):
+                    redirect_uri = urllib.parse.urljoin(
+                        self.application.settings['redirect_base_uri'],
+                        self.reverse_url('facebook_oauth'))
                   if self.get_argument("code", False):
                       user = await self.get_authenticated_user(
-                          redirect_uri='/auth/facebookgraph/',
+                          redirect_uri=redirect_uri,
                           client_id=self.settings["facebook_api_key"],
                           client_secret=self.settings["facebook_secret"],
                           code=self.get_argument("code"))
                       # Save the user with e.g. set_signed_cookie
                   else:
                       self.authorize_redirect(
-                          redirect_uri='/auth/facebookgraph/',
+                          redirect_uri=redirect_uri,
                           client_id=self.settings["facebook_api_key"],
                           extra_params={"scope": "user_posts"})