Skip to content

Commit

Permalink
fix: use userinfo() with okta and don't try decoding as json...
Browse files Browse the repository at this point in the history
  • Loading branch information
Lewiscowles1986 authored Dec 7, 2024
1 parent fab9013 commit cc41ee6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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", ""),
Expand Down
3 changes: 1 addition & 2 deletions flask_appbuilder/security/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit cc41ee6

Please sign in to comment.