From cc41ee6523be6252b37b5bacc55bf7c26474ad52 Mon Sep 17 00:00:00 2001 From: Lewis Cowles Date: Sat, 7 Dec 2024 18:25:52 +0000 Subject: [PATCH] fix: use userinfo() with okta and don't try decoding as json... --- docs/security.rst | 2 +- flask_appbuilder/security/manager.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/security.rst b/docs/security.rst index 2c637ba804..795b23b379 100644 --- a/docs/security.rst +++ b/docs/security.rst @@ -407,7 +407,7 @@ To customize the userinfo retrieval, you can create your own method like this:: response: Dict[str, Any] ) -> Dict[str, Any]: if provider == "okta": - me = sm.oauth_remotes[provider].get("userinfo") + me = sm.oauth_remotes[provider].userinfo() return { "username": "okta_" + me.data.get("sub", ""), "first_name": me.data.get("given_name", ""), diff --git a/flask_appbuilder/security/manager.py b/flask_appbuilder/security/manager.py index d046eec9f0..a090c784a2 100644 --- a/flask_appbuilder/security/manager.py +++ b/flask_appbuilder/security/manager.py @@ -659,8 +659,7 @@ def get_oauth_user_info( return {"username": "openshift_" + data.get("metadata").get("name")} # for Okta if provider == "okta": - me = self.appbuilder.sm.oauth_remotes[provider].get("userinfo") - data = me.json() + data = self.appbuilder.sm.oauth_remotes[provider].userinfo() log.debug("User info from Okta: %s", data) if "error" not in data: return {