Closed pybanaszak closed 1 year ago
Well, the way I proceed in all my use cases is with Auth0User.id or Auth0User.email as the unique key for my own database table/collection.
Practically, your custom user function would be something like:
def get_db_user(auth0user: Auth0User = Security(auth.get_user)) -> User:
# implement or call the relevant db functions: fetch, automatically insert, etc.
This decouples the application database from the auth0 database which is valid across multiple apps as SSO.
Let's say I want to create a user in my database if it does no exist right after the Authorization Flow on all the auth required endpoints. How should I proceed ?