Skip to content

[FAB] Invalid OAuth login with airflow-providers-fab==3.3.0 #62028

@csp33

Description

@csp33

Apache Airflow version

3.1.7

If "Other Airflow 3 version" selected, which one?

No response

What happened?

When installing the apache-airflow-fab-provider v3.3.0, the OAuth login flow doesn't work. Attached video:

Grabacion.de.pantalla.2026-02-16.a.las.16.30.14.mov

API Server logs:

Error on OAuth authorize: Could not build url for endpoint 'CustomAuthOAuthView.oauth_authorized' with values ['provider']. Did you mean 'CustomAuthOAuthView.logout' instead?
2026-02-16T15:30:18.059766Z [error    ] Error on OAuth authorize: Could not build url for endpoint 'CustomAuthOAuthView.oauth_authorized' with values ['provider']. Did you mean 'CustomAuthOAuthView.logout' instead? [flask_appbuilder.security.views] loc=views.py:670

It worked in the previous version that I had installed (3.1.1)

What you think should happen instead?

Login should work

How to reproduce

  1. Install Airflow 3.1.7 and apache-airflow-providers-fab==3.3.0
  2. Set the following webserver_config.py
from typing import Any

from airflow.providers.fab.auth_manager.security_manager.override import FabAirflowSecurityManagerOverride
from flask_appbuilder.security.manager import AUTH_OAUTH
import os

AUTH_TYPE = AUTH_OAUTH
AUTH_USER_REGISTRATION = True
AUTH_USER_REGISTRATION_ROLE = os.environ["AIRFLOW_WEBSERVER_USER_REGISTRATION_ROLE"]
PERMANENT_SESSION_LIFETIME = 1800

OAUTH_PROVIDERS = [
    {
        "name": "github",
        "icon": "fa-github",
        "token_key": "access_token",
        "remote_app": {
            "client_id": os.getenv("GITHUB_OAUTH_APP_ID"),
            "client_secret": os.getenv("GITHUB_OAUTH_APP_SECRET"),
            "api_base_url": "https://api.github.com",
            "client_kwargs": {"scope": "read:user, read:org"},
            "access_token_url": "https://github.com/login/oauth/access_token",
            "authorize_url": "https://github.com/login/oauth/authorize",
            "request_token_url": None,
        },
    },
]


class GithubAuthorizer(FabAirflowSecurityManagerOverride):
    def get_oauth_user_info(self, provider: str, resp: Any) -> dict[str, str | list[str]]:
        remote_app = self.appbuilder.sm.oauth_remotes[provider]
        me = remote_app.get("user")
        user_data = me.json()
        username = user_data["login"]

        try:
            name_surname_list = user_data["name"].split(" ", 1)
            first_name = name_surname_list[0]
            last_name = name_surname_list[1]
        except Exception:
            first_name = last_name = "unknown"

        return {
            "username": username,
            "email": user_data["email"],
            "first_name": first_name,
            "last_name": last_name,
        }


SECURITY_MANAGER_CLASS = GithubAuthorizer
  1. Try to log in

Operating System

airflow in docker

Versions of Apache Airflow Providers

No response

Deployment

Official Apache Airflow Helm Chart

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions