csp33 opened a new issue, #62028:
URL: https://github.com/apache/airflow/issues/62028

   ### 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:
   
   
https://github.com/user-attachments/assets/51308bcf-ba1d-4695-9349-12dd0e789485
   
   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
   ```
   
   ### 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`
   ```python
   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
   
   ```
   3. 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
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to