I am running mlflow inside of the docker container. mlflow has no default authentication but it has basic authentication by running mlflow server --app-name basic-auth
Able to fetch the data when credentials were provided instead of Bearer token default credentials are user=admin,password=password I am encountering a 401 error(unauthorized) while trying to fetch data using the Python requests module, despite setting the MLFLOW_TRACKING_TOKEN environment variable.
In the documentation they mentioned: MLFLOW_TRACKING_USERNAME and MLFLOW_TRACKING_PASSWORD - username and password to use with HTTP Basic authentication. To use Basic authentication, you must set both environment variables .
MLFLOW_TRACKING_TOKEN - token to use with HTTP Bearer authentication. Basic authentication takes precedence if set.
reference:https://mlflow.org/docs/latest/tracking/server.html
Steps to Replicate 1.Run MLflow inside a Docker container. 2.exec into the container. 3.export MLFLOW_TRACKING_TOKEN=<random_string>.
I tried the following ways: import requests
##working with credentials response = requests.get(r'http://<tracking_uri:5000/api/2.0/mlflow/experiments/search', json={"max_results":10}, auth=("admin","password"))
##but not working with Bearer token response = requests.get(r'http://<tracking_uri:5000/api/2.0/mlflow/experiments/search', json={"max_results":10}, headers={"Authorization":f"Bearer <random_string>"}) print(response)
##error You are not authenticated. Please see https://www.mlflow.org/docs/latest/auth/index.html#authenticating-to-mlflow on how to authenticate.