Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access token through API #71

Open
lyy20000701 opened this issue Jan 14, 2025 · 4 comments
Open

How to access token through API #71

lyy20000701 opened this issue Jan 14, 2025 · 4 comments

Comments

@lyy20000701
Copy link

Hi dear developers! Is there any way to use this api(GET_ACCESS_TOKEN: '/api/2.0/mlflow/users/access-token') to automatically get access token for users? What should be put in request header? I tried several ways to send in username and password but cannot obtain correct token.

@kharkevich
Copy link
Contributor

hello, you should send correct auth header or reuse flask session

@ion-elgreco
Copy link
Contributor

@kharkevich do you have an example of the correct auth header?

@kharkevich
Copy link
Contributor

sure, for example: https://chatgpt.com/share/678fc108-fbf8-8001-a2b7-2e1271bff92a

@ion-elgreco
Copy link
Contributor

ion-elgreco commented Jan 31, 2025

So I am sort of able to get it workin. I have an OIDC which uses client_id, client_secret.

My client_id is configured to have a hardcoded user claim, pointing to my own user account for now. Then I fetch an access token from the OIDC provider using the client_id, client_secret and pass this as a bearer token to: /api/2.0/mlflow/users/access-token.

In the JWT bearer token it will have email: "my-user-email"

And now I successfully get an access token, since the api was properly authenticated. But this is only because my user account was created when configuring mlflow.

I want however to be able to generate an access token for a functional account in mlflow, that I can use in automated pipelines. Any suggestions here @kharkevich? Not sure what the best approach is to create an account through the API.

I can do it manually by creating an account in my OIDC, logging with that account into the mlflow ui and then have the user be auto created but there must be a better way for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants