CLI only login to Auth0 using auth0-python library?


I am writing a command line utility to interact with an API secured using Auth0. The existing open source GUI clients launch a web browser window to display and handle the login flow using the standard Auth0 login page. I would very much like to handle the login in completely programmatic way. Is this possible?

I am not deeply familiar with Oauth and authentication standards so here is a working example of logging in using the browser to authenticate and finally obtain an id_token that I’m able to use to access my target API.

I’ve tried using the auth0-python library’s auth0.v3.authentication Social login function, but it is looking for an access_token which I don’t think I have?

Is it possible to login programmatically with username and password to the Auth0 login provider? If not, is there a way of obtaining a reusable token that could be used non-interactively?

Many thanks!

Hi @dkozel

Take a look at this:

I wrote it 2 years ago and haven’t touched it since, so no guarantees.

It opens a browser from Python to do the log in.

It is a little messy - the browser is left open after the login is complete.


1 Like

Thanks John! We’ll have a look and see if the API we’re trying to access will accept access tokens.