Skip to content

Commit

Permalink
fix: Check if Oauth login with OKTA is correct (#1926)
Browse files Browse the repository at this point in the history
  • Loading branch information
safeith authored Mar 12, 2024
1 parent 0ab8b4e commit c65e067
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions flask_appbuilder/security/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,13 +660,17 @@ def get_oauth_user_info(
me = self.appbuilder.sm.oauth_remotes[provider].get("userinfo")
data = me.json()
log.debug("User info from Okta: %s", data)
return {
"username": f"{provider}_{data['sub']}",
"first_name": data.get("given_name", ""),
"last_name": data.get("family_name", ""),
"email": data["email"],
"role_keys": data.get("groups", []),
}
if "error" not in data:
return {
"username": f"{provider}_{data['sub']}",
"first_name": data.get("given_name", ""),
"last_name": data.get("family_name", ""),
"email": data["email"],
"role_keys": data.get("groups", []),
}
else:
log.error(data.get("error_description"))
return {}
# for Auth0
if provider == "auth0":
data = self.appbuilder.sm.oauth_remotes[provider].userinfo()
Expand Down

0 comments on commit c65e067

Please sign in to comment.