How to implement Auth0 Authentication with custom backend

How would I go about identifying my users to my custom backend? For example, let’s say the user logs into my app through Auth0 and gets an access token. If, in this example app, users’ IDs are tied to certain data in my database (i.e. their posts, etc.), what is the ideal setup for getting the correct info for the logged in user? Normally, my users table would have an ‘id’ column which would act as their identifier. I am trying to figure out the best way to connect the two. I know there is a way to add custom database connections and get user info through that method but it seems limited when I want to expand to more complex things than just simply getting their username and profile picture, for example.

If a user is logged in and creates a new post should I retrieve his information and then send it as part of the request that then gets handled by my backend?

Any help is appreciated.

Hi @spikeedoo14

In general, Auth0’s user database should only hold the auth information about the user, and your backend should have a database with all other info about the user.

To connect the two, you need a unique ID. This can come from your DB or you can use Auth0’s user_id.

When you create a user, you must add an entry to your DB that notes that the new user is tied to Auth0 info via this ID.

Then make sure that ID is in your access token.