I have recently upgraded my Airflow version from v1.10.6 to v2.2.3(Latest version). I created a user with role - User.
airflow users create \
--role User \
--username DEVUSER \
--firstname DEV \
--lastname USER \
--email my_email@gmail.com
Password is devairflowuser
I'm trying to Trigger a new Dag Run using the below curl command :
curl -X POST 'http://localhost:8083/api/v1/dags/handling_migrations_task_request/dagRuns' -H 'Content-Type: application/json' --user "DEVUSER:devairflowuser" -d '{
}'
But, I get 401 error Unauthorized:
{
"detail": null,
"status": 401,
"title": "Unauthorized",
"type": "https://airflow.apache.org/docs/apache-airflow/2.2.3/stable-rest-api-ref.html#section/Errors/Unauthenticated"
}
In airflow.cfg
auth_backend = airflow.api.auth.backend.basic_auth
But, with Admin credentials I'm able to trigger a new Dag run. From this - https://airflow.apache.org/docs/apache-airflow/stable/security/access-control.html#user. I can see that Role-User can also create a Dag run
(permissions.ACTION_CAN_CREATE, permissions.RESOURCE_DAG_RUN)
Any help is appreciated. Thanks!