airflow.providers.fab.auth_manager.views.auth_oauth

Custom OAuth authentication view to fix session timing race condition.

Attributes

log

Classes

CustomAuthOAuthView

Custom OAuth authentication view that ensures session is committed before redirect.

Module Contents

airflow.providers.fab.auth_manager.views.auth_oauth.log[source]
class airflow.providers.fab.auth_manager.views.auth_oauth.CustomAuthOAuthView[source]

Bases: flask_appbuilder.security.views.AuthOAuthView

Custom OAuth authentication view that ensures session is committed before redirect.

Fixes issue #57981 where UI requests fail with 401 during OAuth flow because the Flask session is not yet committed when the redirect response is sent.

oauth_authorized(provider)[source]

OAuth callback handler that explicitly commits session before redirect.

This method overrides the parent’s oauth_authorized to ensure that the Flask session (containing OAuth tokens and user authentication) is fully committed to the session backend (cookie or database) before redirecting the user to the UI.

This prevents the race condition where the UI makes API requests before the session is available, causing temporary 401 errors during login.

Args:

provider: OAuth provider name (e.g., ‘azure’, ‘google’, ‘github’)

Returns:

Flask response object (redirect to original URL or home page)

Was this entry helpful?