User info from a Acess Token

I’m pretty new to Auth0 so trying to make my way around the docs but can’t seem to understand a few things. Hoping that someone can help me out. I have an API I am trying to connect to Auth0. I have managed to get an example working of a Login on the front end that sends the token to the backend API. The backend in on Node and I can validate the JWT Token using middleware. So far so good.

My question now is how would I actually use the user information on the backend using this validated token? I’ve thought about somehow sending it from the front end app but I think this wouldn’t be such a great idea security wise.

Hi hiltonmeyer

I assume you have lots of information about users stored in a DB somewhere. Then it could go something like this:

On signup, get the user identifier from your user DB and store that in the Auth0 DB for the user.

Create a rule that puts your user identifier in the access token.

In your node backend, get the user identifier and use that to look up all the info you need.

This is just one approach, you have a lot of flexibility here.

John

2 Likes

Thanks a lot for sharing this approach John!

Hi John,
Thanks for the help. So there is not real problem sending the user id in the access token?
Could you please point me in the direction of an example or even better the docs.
I’ve been trying to work through the docs but getting very confused.
Appreciate the help and patience
Hilton

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.