githuboauthairflowauthlibflask-oauthlib

Airflow GitHub Authentication Failing


I have a working instance of Airflow already. I am now trying to set up Airflow with GitHub Enterprise Authentication. There is not much available as far as documentation and I did not find any good examples online so I am having some trouble. The Airflow instance works fine when I have authentication set to false, but when I try to turn on the authentication and start up the Airflow instance I get the following error CRITICAL - Cannot import authentication module airflow.contrib.auth.backends.github_enterprise_auth. Please correct your authentication backend or disable authentication: No module named 'flask_oauthlib'

The relevant portion of the airflow.cfg file is as follows:

[webserver]
authenticate = True
auth_backend = airflow.contrib.auth.backends.github_enterprise_auth

[github_enterprise]
api_rev = v3
host = github.com
# From your OAuth app
client_id = CLIENT_ID_CODE
client_secret = CLIENT_SECRET_CODE
oauth_callback_route = /oauth/callback
# airflow team in github
# allowed_teams =

I tried completely recreating my virtual Python environment and pip installing Flask_OAuthlib but still no luck.

Is there anyone who knows how to do this and could explain to me how to get this working.

This is the only documentation I could find on the subject and I am still not clear.


Solution

  • I figured out how to get the flask_oauthlib module. I am creating Airflow through a Docker instance and I the correct modules installed in my Python virtual environment, but I didn't have the correct pip install statement in my Dockerfile.