Auth0 Home Blog Docs

How to login through a SAML-connection using the auth0-python library?

Hi, I’m using the auth0-python library ( and would like to enable user login through my SAML-connection.

I’m trying to use the GetToken class, but I’m really having trouble using the docs to acheive what I want.

Please help!

Hey there @diddeper!

Would you mind sharing a little bit more context around how you’re building it?

Can you share with us any code snippets and link to the docs you used cause you linked main docs site and I’m not sure which tutorial you use.

Thanks a lot!

Thanks for the swift reply, @konrad.sopala!

What I’m trying to achieve is to let users authenticate and login via Python (not a web app, so no flask), something similar to what the .webAuth method provides for a mobile app.

I’ve been trying to use the login method from GetToken (

I’ve also tried the client_credentials method from GetToken:

//Code starts
request = GetToken(domain)
response = request.client_credentials(clientId, clientSecret, ‘’.format(domain))
token = response[‘access_token’]

from import Auth0

auth0 = Auth0(domain, token)

//Code ends

I have not managed to achieve anything with the login method as my only connection is a SAML connection and users have to authenticate with username/password towards the Identity Provider.

The client_credentials method provides me with the attributes that I want, but this method needs to know the user_id. I can’t get hold of the user_id unless the user already is authenticated through the Identity Provider.

I’ve looked at these quickstart as well, but these are meant for web apps bulit on Flask: