Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic authentication with Python API does not work in main Airflow #36377

Closed
2 tasks done
potiuk opened this issue Dec 22, 2023 · 4 comments
Closed
2 tasks done

Basic authentication with Python API does not work in main Airflow #36377

potiuk opened this issue Dec 22, 2023 · 4 comments
Assignees
Milestone

Comments

@potiuk
Copy link
Member

potiuk commented Dec 22, 2023

Apache Airflow version

main (development)

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

No response

What happened?

Looks like API authentication does not work with main version of airflow in breeze. The API calls are refused with 401 HTTP authentication error.

What you think should happen instead?

The client should authenticate with basic_auth.

How to reproduce

When you test Python client with https://github.com/apache/airflow-client-python/blob/main/dev/test_python_client.py (and earlier configure the webserver with:

auth_backends = airflow.api.auth.backend.session,airflow.api.auth.backend.basic_auth

the webserver refuses the connection with:

[2023-12-22T22:06:59.292+0000] {security_handler_factory.py:382} INFO - ... No auth provided. Aborting with 401.
                                                                                                                                                  │127.0.0.1 - admin [22/Dec/2023:22:06:59 +0000] "GET /api/v1/config HTTP/1.1" 401 124 "-" "OpenAPI-Generator/2.7.3/python"

This is the same for apache-airflow-client==2.7.3 and apache-airflow-client==2.8.0 .

When you use --use-airflow-version==2.8.0, it works just fine, so the problem seems to be coming from some recent changes in main.

Operating System

Breeze CI image (debian-bookworm)

Versions of Apache Airflow Providers

main version

Deployment

Other

Deployment details

Breeze

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@potiuk potiuk added kind:bug This is a clearly a bug area:core needs-triage label for new issues that we didn't triage yet labels Dec 22, 2023
@potiuk
Copy link
Member Author

potiuk commented Dec 22, 2023

cc: @vincbeck

@potiuk potiuk modified the milestones: Airflow 2.8.1, Airflow 2.9.0 Dec 22, 2023
@RNHTTR RNHTTR removed the needs-triage label for new issues that we didn't triage yet label Dec 29, 2023
@vincbeck
Copy link
Contributor

vincbeck commented Jan 2, 2024

Interesting ... When I run Airflow using Breeze (breeze start-airflow --skip-asset-compilation --backend postgres), I can successfully get the list of DAGs by calling the API http://localhost:28080/api/v1/dags in Postman using Basic auth

@potiuk
Copy link
Member Author

potiuk commented Jan 2, 2024

Hmm. let me try again. Maybe that was something I made mistake about (though I did it a the time I verified Python client and this is where I found it).

@potiuk potiuk self-assigned this Jan 2, 2024
@potiuk
Copy link
Member Author

potiuk commented Jan 2, 2024

Yep. Can't reproduce. It works just fine in main. Must have been some mistake I've done (or something was fixed since in main :D ).

Sorry for the noise.

@potiuk potiuk closed this as completed Jan 2, 2024
@potiuk potiuk added the invalid label Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants