Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use userinfo() with okta and don't try decoding a hash as json #2292

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading