-
Notifications
You must be signed in to change notification settings - Fork 66
Open
Description
The OIDCAuth class and group-based features added in 2.3.0 are great!
It would be useful for the OIDCAuth class to take a callable that is executed at the end of the OIDCAuth.callback method just before the redirect. This function would take the access token as single positional argument and have access to the session global, e.g.:
from dash import Dash
from dash_auth import OIDCAuth
from flask import session
def add_scopes_to_user(token):
if scope := token.get("scope"):
session["user"]["scopes"] = scope.split()
app = Dash(__name__)
auth = OIDCAuth(
app,
secret_key="aStaticSecretKey!",
post_auth_callback=add_scopes_to_user, # defaults to None
)This feature would provide a lot of flexibility to app developers for different use cases:
- storage of additional fields from the token in the session (example above),
- add a user to the DB if not already existing,
- custom logging,
- etc.
I can submit a PR if this is a feature the maintainers would consider merging.
yann-h and FrancisRalph
Metadata
Metadata
Assignees
Labels
No labels