File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 55import hashlib
66import os
77import secrets
8- from urllib .parse import urlencode , urlparse
8+ from urllib .parse import parse_qsl , urlencode , urlparse
99
1010import httpx
1111import reflex as rx
@@ -141,6 +141,10 @@ def _index_uri(self) -> str:
141141 current_url = urlparse (self .router .url )
142142 return current_url ._replace (path = "/" , query = None , fragment = None ).geturl ()
143143
144+ def _query_params (self ) -> dict [str , str ]:
145+ """Retrieve the query parameters from url since router.page is deprecated."""
146+ return dict (parse_qsl (urlparse (self .router .url ).query ))
147+
144148 @rx .event
145149 async def redirect_to_login_popup (self ):
146150 """Open a small popup window to initiate the login flow.
@@ -237,8 +241,9 @@ async def auth_callback(self):
237241 and stores tokens for future use.
238242 """
239243 headers = {"Content-Type" : "application/x-www-form-urlencoded" }
240- code = self .router .page .params .get ("code" )
241- app_state = self .router .page .params .get ("state" )
244+ params = self ._query_params ()
245+ code = params .get ("code" )
246+ app_state = params .get ("state" )
242247 if app_state != self ._app_state :
243248 self .error_message = "App state mismatch. Possible CSRF attack."
244249 return rx .toast .error ("Authentication error" )
You can’t perform that action at this time.
0 commit comments