Hello All,
Trying to setup Frappe OAuth with Apache Superset.
-
Base Url in Social Login Key is
http://frappehost.com
-
OAuth Client Setup redirect url as
http://supersethost/oauth-authorized/frappe
Grant Type - Authorization Code
Response Type - Code -
OAuth Settings in superset
from flask_appbuilder.security.manager import AUTH_OAUTH
AUTH_TYPE = AUTH_OAUTH
OAUTH_PROVIDERS = [
{ 'name':'frappe',
'token_key':'code', # Name of the token in the response of access_token_url
'icon':'fa-address-card', # Icon for the provider
'remote_app': {
'client_id':'xxxxx', # Client Id (Identify Superset application)
'client_secret':'yyyyy', # Secret for this Client Id (Identify Superset application)
'client_kwargs':{
'scope': 'openid' # Scope for the Authorization
},
'access_token_method':'POST', # HTTP Method to call access_token_url
'access_token_params':{ # Additional parameters for calls to access_token_url
'client_id':'xxxxx'
},
'access_token_headers':{ # Additional headers for calls to access_token_url
'Authorization': 'token xxxxx:yyyyy'
},
'api_base_url':'http://frappehost.com/api/method/frappe.integrations.oauth2.openid_profile',
'access_token_url':'http://frappehost.com/api/method/frappe.integrations.oauth2.get_token',
'authorize_url':'http://frappehost.com/api/method/frappe.integrations.oauth2.authorize'
}
}
]
Below error occurs:
"POST /api/method/frappe.integrations.oauth2.get_token HTTP/1.1" 401 1620 superset_app | 2021-11-30 07:08:20,842:INFO:root:{'exc_type': 'AuthenticationError', 'exc': '["Traceback (most recent call last):\\n File \\"/home/frappe/frappe-bench/apps/frappe/frappe/app.py\\", line 66, in application\\n response = frappe.api.handle() \\n File \\"/home/frappe/frappe-bench/apps/frappe/frappe/api.py\\", line 40, in handle\\n validate_auth_via_api_keys()\\n File \\" /home/frappe/frappe-bench/apps/frappe/frappe/api.py\\", line 172, in validate_auth_via_api_keys\\n raise e\\n File \\"/home/frappe/ frappe-bench/apps/frappe/frappe/api.py\\", line 167, in validate_auth_via_api_keys\\n validate_api_key_secret(token[0], token[1])\\n File \\"/home/frappe/frappe-bench/apps/frappe/frappe/api.py\\", line 181, in validate_api_key_secret\\n user_secret = frappe.utils .password.get_decrypted_password (\\"User\\", user, fieldname=\'api_secret\')\\n File \\"/home/frappe/frappe-bench/apps/frappe/frappe/ utils/password.py\\", line 50, in get_decrypted_password\\n frappe.throw(_(\'Password not found\'), frappe.AuthenticationError)\\n File \\"/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py\\", line 360, in throw\\n msgprint(msg, raise_exception=exc, title= title, indicator=\'red\')\\n File \\"/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py\\", line 346, in msgprint\\n _raise_e xception()\\n File \\"/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py\\", line 315, in _raise_exception\\n raise raise_exc eption(msg)\\nfrappe.exceptions.AuthenticationError: Password not found\\n"]', '_server_messages': '["{\\"message\\": \\"Password not f ound\\", \\"indicator\\": \\"red\\"}"]'}
Able to get around this error if I comment the validate_auth_via_api_keys. It receives an Authorization Header with the OAuth Client Id and Secret (xxxxx:yyyyy) in above example. This is not available in the Frappe Users table and hence it fails.
Could someone help with what could be the possible configuration mistake ?
Thank you