Santhosh Sridhar
Santhosh Sridhar

Reputation: 671

Apache airflow REST API call fails with 403 forbidden when API authentication is enabled

Apache Airflow REST API fails with 403 forbidden for the call:

"/api/experimental/test"

Configuration in airflow.cfg

[webserver]

[api]

After setting all this, docker image is built and run as a docker container.

Created the airflow user as follows:

airflow create_user -r Admin -u admin -e [email protected] -f Administrator -l 1 -p admin

Login with credentials for Web UI works fine.

Where as login to REST API is not working. HTTP Header for authentication: Authorization BASIC YWRtaW46YWRtaW4=

Airflow version: 1.10.9

Upvotes: 3

Views: 4219

Answers (2)

Frank xun
Frank xun

Reputation: 1

i think 'admin' user is not ok for openMetadata's link,you can create a new user at airflow

Upvotes: 0

Santhosh Sridhar
Santhosh Sridhar

Reputation: 671

By creating user in the following manner we can access the Airflow experimental API using credentials.

import airflow
from airflow import models, settings
from airflow.contrib.auth.backends.password_auth import PasswordUser
user = PasswordUser(models.User())
user.username = 'new_user_name'
user.email = '[email protected]'
user.password = 'set_the_password'
session = settings.Session()
session.add(user)
session.commit()
session.close()
exit()

By creating user with "airflow create_user" command, we cannot access the Airflow Experimental APIs.

Upvotes: 8

Related Questions