After changing the airflow.cfg
, I simply changed the authenticate to True like this:
[webserver]
authenticate = True
auth_backend = airflow.contrib.auth.backends.password_auth
when I run command airflow webserver
, there was an Error as below:
File "/home/airflow/.pyenv/versions/3.7.3/lib/python3.7/site-packages/airflow/contrib/auth/backends/password_auth.py", line 33, in <module>
from flask_bcrypt import generate_password_hash, check_password_hash
ModuleNotFoundError: No module named 'flask_bcrypt'
...
File "/home/airflow/.pyenv/versions/3.7.3/lib/python3.7/site-packages/airflow/__init__.py", line 73, in load_login
raise AirflowException("Failed to import authentication backend")
airflow.exceptions.AirflowException: Failed to import authentication backend
Just added the content in airflow.cfg file.
[webserver]
authenticate = True
auth_backend = airflow.contrib.auth.backends.password_auth
Solved it .
pip install flask-bcrypt
pip3 install flask-bcrypt --user
did the trick for me.
The official way to fix this error is by installing the password
subpackage, which will pull in the needed dependencies for password authentication.
pip install 'apache-airflow[password]'
A list of available subpackages is available in the airflow docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With