Okta Oauth - Fails with 'Response' object has no attribute 'data'
See original GitHub issueWe are trying to use Okta Oauth for Airflow authentication now that PR-1571 has been merged and 3.2.0 released.
We are currently set up with Google Oauth and that is working perfectly.
Environment
Flask-Appbuilder version: 3.2.0
pip freeze output:
Flask-AppBuilder==3.2.0
Authlib==0.15.2
Describe the expected results
Okta OAuth response should contain data attribute and authorize.
Describe the actual results
OAuth response doesnt contain data and authorization fails.
Retrieve temporary data: {'code': 'xxxx', 'state': 'xxxxxxx, 'redirect_uri': 'https://xxxxxx/oauth-authorized/okta'}
airflow-web [2021-02-26 20:46:32,146] {views.py:693} ERROR - Error returning OAuth user info: 'Response' object has no attribute 'data'
Steps to reproduce
Configure FAB 3.2.0 to use Okta Oauth
# ----------------------------------------------------
# AUTHENTICATION CONFIG
# ----------------------------------------------------
# For details on how to set up each of the following authentication, see
# http://flask-appbuilder.readthedocs.io/en/latest/security.html# authentication-methods
# for details.
# The authentication type
AUTH_TYPE = AUTH_OAUTH
# Uncomment to setup Full admin role name
AUTH_ROLE_ADMIN = 'Admin'
# Uncomment to setup Public role name, no authentication needed
# AUTH_ROLE_PUBLIC = 'Public'
# Will allow user self registration
AUTH_USER_REGISTRATION = True
# The default user self registration role
AUTH_USER_REGISTRATION_ROLE = "Viewer"
# When using OAuth Auth, uncomment to setup provider(s) info
# Google OAuth example:
OAUTH_PROVIDERS = [{
"name": "okta",
"icon": "fa-circle-o",
"token_key": "access_token",
"remote_app": {
"client_id": 'xxxxx',
"client_secret": 'xxxxx',
"api_base_url": "https://xxx.okta.com/oauth2/v1/",
"client_kwargs": {"scope": "openid profile email groups"},
"access_token_url": "https://xxx.okta.com/oauth2/v1/token",
"authorize_url": "https://xxxx.okta.com/oauth2/v1/authorize",
},
}]
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Okta API Error Codes - Okta Developer
API validation failed for the current request. This is a fairly general error that signifies that endpoint's precondition has been violated.
Read more >Why do I get error AttributeError: 'Response' object has no ...
Assuming you are using Requests library, the Response object does not have a get method. The link given explains the attributes and methods ......
Read more >Troubleshooting SAML 2.0 federation with AWS
This error can occur when the SAML response from the identity provider does not include an attribute with the Name set to https://aws.amazon.com/SAML/Attributes...
Read more >okta_app_oauth | Resources | okta/okta - Terraform Registry
omit_secret - (Optional) This tells the provider not to persist the application's secret to state. Your app's client_secret will be recreated if this...
Read more >Using the Python Connector - Snowflake Documentation
Connecting with OAuth. OCSP. Choosing Fail-Open or Fail-Close Mode. Verifying the OCSP Connector or Driver Version. Caching OCSP Responses.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jonathonbattista it’s expected to return a response object, could you change it to
me.data
orme.json()
?@dpgaspar we could probably improve the docs with reference to how to debug OAUTH responses, like you said.