Cutomize OIDCAuth to get userinfo
This commit is contained in:
parent
f6d2373f39
commit
862cccac7b
@ -561,6 +561,21 @@ def intelligent_loop_plots(sym, stk_data):
|
|||||||
# return True
|
# return True
|
||||||
# return False
|
# return False
|
||||||
|
|
||||||
|
class OIDCAuthCustom(OIDCAuth): # overide OIDCAuth to get logged in user info
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
self.userinfo = None
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
def callback(self, idp: str):
|
||||||
|
return_value = super().callback(idp)
|
||||||
|
|
||||||
|
client = self.get_oauth_client(idp)
|
||||||
|
self.userinfo = client.userinfo()
|
||||||
|
# ...
|
||||||
|
|
||||||
|
return return_value
|
||||||
|
|
||||||
# Initialize the app
|
# Initialize the app
|
||||||
app = Dash(__name__)
|
app = Dash(__name__)
|
||||||
|
|
||||||
@ -571,7 +586,10 @@ app = Dash(__name__)
|
|||||||
# secret_key="MK8dyS6PyDDuEuzrmqa7dJTJZ7eH2Jkh",
|
# secret_key="MK8dyS6PyDDuEuzrmqa7dJTJZ7eH2Jkh",
|
||||||
# )
|
# )
|
||||||
|
|
||||||
auth = OIDCAuth(app, secret_key=os.environ['SECRET_KEY'])
|
# auth = OIDCAuth(app, secret_key=os.environ['SECRET_KEY'])
|
||||||
|
|
||||||
|
auth = OIDCAuthCustom(app, secret_key=os.environ['SECRET_KEY'])
|
||||||
|
|
||||||
auth.register_provider(
|
auth.register_provider(
|
||||||
"stock",
|
"stock",
|
||||||
token_endpoint_auth_method="client_secret_post",
|
token_endpoint_auth_method="client_secret_post",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user