How to fetch Custom data after login?


Hello, I am using a custom database as mongodb and it is working fine but the problem I am facing is that I want some other field after login i.e verified, mobile no. to be send in the id token. How can I do so.
Please help me.
Thanks in advance.

1 Like

Hi @owacode Welcome to auth0 community.

You can add custom claims to idtoken or accessToken via rules. Please refer to our documentation here for more details and sample rule OpenID Connect Scopes

I’m struggling with something similar. Is the sub property of the access token the users id?

For example, if I’m creating a todo app and I want to show todo’s owned by a specific user when the user calls can I use the access_token subject as an id? Allowing me to use something like “get all todos where id equals user.sub”

Never mind I found the answer to my question here.

You are correct in that the access_token should be used to make authenticated calls to your API. The access_token contains a sub claim, that will contain the user identifier of the user for which the application was granted an access_token. In your API, after you have validated the access_token, you can use the sub claim as the user_id in your backend

Sounds great Daniel! Please let us know if we can be further of assistance in the future!

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