You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using OAuth2 for login, but I keep getting an "invalid_client" error. I'm quite sure that the client_id and client_secret are correct. Could it be that there's something wrong with the configuration?
from future import annotations
import os
from airflow.www.security import AirflowSecurityManager
from airflow.www.fab_security.manager import AUTH_OAUTH
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using OAuth2 for login, but I keep getting an "invalid_client" error. I'm quite sure that the client_id and client_secret are correct. Could it be that there's something wrong with the configuration?
from future import annotations
import os
from airflow.www.security import AirflowSecurityManager
from airflow.www.fab_security.manager import AUTH_OAUTH
basedir = os.path.abspath(os.path.dirname(file))
WTF_CSRF_ENABLED = True
WTF_CSRF_TIME_LIMIT = None
AUTH_TYPE = AUTH_OAUTH
OAUTH_BASE_URL = 'http://yjy.dev.jinxin234.cloud:9000'
OAUTH_PROVIDERS = [{
'name': 'leaf-auth',
'token_key': 'access_token',
'icon': 'fa-leaf-auth',
'remote_app': {
'api_base_url': f'{OAUTH_BASE_URL}/auth2/oauth2',
'client_kwargs': {
'scope': 'all openid profile'
},
'access_token_url': f'{OAUTH_BASE_URL}/auth2/oauth2/token',
'authorize_url': f'{OAUTH_BASE_URL}/auth2/oauth2/authorize',
'request_token_url': None,
'client_id': 'auth-for-airflow',
'client_secret': 'secret'
}
}]
class CustomSecurityManager(AirflowSecurityManager):
def oauth_user_info(self, provider, response):
if provider == 'leaf-auth':
SECURITY_MANAGER_CLASS = CustomSecurityManager
AUTH_USER_REGISTRATION = True
AUTH_USER_REGISTRATION_ROLE = 'Admin'
Beta Was this translation helpful? Give feedback.
All reactions