Forum Discussion
DAGRun via API
Hi saritboo
Modify the 'airflow.cfg' file to enable basic authentication. You need to set the 'auth_backend' to 'airflow.api.auth.backend.basic_auth'. This allows you to use basic authentication for API calls.
[api]
auth_backend = airflow.api.auth.backend.basic_auth
Ensure you have a user created in Airflow with the necessary permissions to trigger DAGs.
When making API calls from a shell script or Postman, include the 'Authorization' header with the base64 encoded username and password. Here’s an example using 'curl'
curl -X POST "http://your-airflow-url/api/v1/dags/your_dag_id/dagRuns" \
-H "Authorization: Basic $(echo -n 'username:password' | base64)" \
-H "Content-Type: application/json" \
-d '{"conf": {"key": "value"}}'
By following these steps, you should be able to authenticate and run Airflow DAGs via API calls without being redirected to the Microsoft login page
Here's the link for your reference:
API Authentication — apache-airflow-providers-fab Documentation
Best Regards
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.