Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot access Apache Airflow web UI when enabling authenticate = True

Tags:

airflow

I have apache airflow running perfectly fine with default settings, when I set authenticate = False in the the airflow.cfg file

But I am unable to access the Web UI when i set authenticate = True I am following the instructions from the website https://incubator-airflow.readthedocs.io/en/latest/security.html

I am using Version : 1.10.1

When i try to access web ui, I get the message This site can’t be reached or too many redirects

airflow.cfg file

[webserver]

authenticate = True
auth_backend = airflow.contrib.auth.backends.password_auth

Create my user with python

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

restart airflow

like image 606
umartin67 Avatar asked Oct 24 '25 02:10

umartin67


2 Answers

I've tried the way same as yours to create airflow user, it couldn't work. Simply you can use command like this airflow create_user -r Admin -u admin -e [email protected] -f admin -l user -p test in airflow webserver shell.

like image 134
shawn Avatar answered Oct 26 '25 22:10

shawn


create_user seems to be deprecated, so please use this:

airflow users create --username admin --role Admin --email [email protected] --firstname A --lastname B
like image 42
Sławomir Lenart Avatar answered Oct 26 '25 21:10

Sławomir Lenart