I'm experiencing problems with Google OAUTH login after updating Airflow
to version 2.2.5
and Authlib
required as constraint to be at version 1.0.0.
Here my previous webserver_config.py
import os
from airflow.www.fab_security.manager import AUTH_OAUTH
# from flask_appbuilder.security.manager import AUTH_OAUTH
from airflow.configuration import conf
basedir = os.path.abspath(os.path.dirname(__file__))
# The SQLAlchemy connection string.
AUTH_TYPE = AUTH_OAUTH
AUTH_USER_REGISTRATION = True
AUTH_USER_REGISTRATION_ROLE = "Viewer"
AUTH_USER_REGISTRATION_ROLE_JMESPATH = "contains(['$$CUSTOM_ADMIN_EMAIL$$'], email) && 'Admin' || contains(['$$CUSTOM_USER_EMAIL$$'], email) && 'User' || 'Viewer'"
CSRF_ENABLED = True
# The SQLAlchemy connection string.
SQLALCHEMY_DATABASE_URI = conf.get('core', 'SQL_ALCHEMY_CONN')
OAUTH_PROVIDERS = [
{'name': 'google', 'icon': 'fa-google', 'token_key': 'access_token',
'whitelist': ['@$$CUSTOM_DOMAIN$$'],
'remote_app': {
'client_id': '$$CLIENT_ID$$',
'client_secret': '$$CLIENT_SECRET$$',
'api_base_url': 'https://www.googleapis.com/oauth2/v2/',
'client_kwargs': {
'scope': 'email profile'
},
'request_token_url': None,
'access_token_url': 'https://accounts.google.com/o/oauth2/token',
'authorize_url': 'https://accounts.google.com/o/oauth2/auth'}
},
]
After trying to login it appears:
With this error log:
[2022-04-06 06:44:39,729] {views.py:671} ERROR - Error returning OAuth user info: missing_token:
Anyone knows if it's a bug or I'm missing updates to be done in the code after the update?
Thanks @lepture. We updated cosntraints for Airflow 2.2.5
and refreshed the images with Authlib=1.0.1 now !