Rick Giuly
Rick Giuly

Reputation: 1043

Airflow api authentication example from the documentation is giving me a 401

Using airflow version 2.1.2

I'm trying the following API call from the airflow documentation:

ENDPOINT_URL="http://localhost:8080/"
curl -X GET  \
    --user "admin:hello" \
    "${ENDPOINT_URL}/api/v1/pools"

But it's not working for me. The result is following:

{
  "detail": null,
  "status": 401,
  "title": "Unauthorized",
  "type": "https://airflow.apache.org/docs/apache-airflow/2.1.2/stable-rest-api-ref.html#section/Errors/Unauthenticated"
}

I tried the login a few times from the GUI to make sure name and password were right, and they were.

My auth setting:

$ airflow config get-value api auth_backend
airflow.api.auth.backend.basic_auth

Upvotes: 1

Views: 3831

Answers (1)

Rick Giuly
Rick Giuly

Reputation: 1043

OK found the issue: Had to restart the airflow webserver for the authentication configuration to take effect.

Upvotes: 4

Related Questions