-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
currently, if a user has logged in okta but his session has expired, the dash app is not updated anymore as the calls to /_dash-... are receiving a redirect (302) they cannot manage.
I have hacked the following solution that appears to work:
- add an element of type
dcc.Location(refresh=True, id="URL_OUT"),in the app layout - trigger a change on this element when Dash is sending a /_dash-update-component and the session is not authorized. For this, change in the "login_request" (https://github.com/fspijkerman/dash-okta-auth/blob/master/dash_okta_auth/okta_oauth.py#L45) from
def login_request(self):
# send to okta auth page
return redirect(url_for("okta.login"))
to
def login_request(self):
# send to okta auth page
if request.path.startswith("/_dash-update-component"):
import json
return json.dumps({"response": {"URL_OUT": {"href": "http://127.0.0.1:8051/login/okta"}}, "multi": True})
return redirect(url_for("okta.login"))
Today, the ID of the dcc.Location is hardcoded but it could be passed as a configuration parameter.
Is this a reasonable fix ?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels