Hello Everyone! I am new to auth0 and I’m trying to implement it within my react application. How does my application know who has logged in so I can pull relevant user data from my database after auth0 authentication. So the user hits login —> authenticates (or creates a new account) via auth0 —> get redirected to my app (the page i specify in settings) but how does my application know who has logged in? Thanks!
Hi @tandan,
Welcome to the Community!
The ID token will provide your react app with information about the user.
Take a look at our quickstart that walks through the Auth0 React SDK.
Thanks Dan! I will take a look.
Let us know if you have any additional questions!
Hey Dan, I was able to pull the user data per the instructions in the React SDK… currently, the name of the user is the email address. is there a way to have auth0 ask for the name or perhaps make a post request to update the name into the users profile? Also, I have required username, but im unable to get it to render in the profile component?
You can send a patch request to update the user’s name with the update users endpoint.
This should be done from your backend/API.
Can you show us what you are doing and why it is not working? Is it being returned in the token?
Hi Dan, I have configured my sign in to ask for a username. Im simply trying to pull the username into my page. The name and image are being pulled fine and are being rendered. I have used conditional rendering to show the login/logout button. Perhaps, its not possible to pull the username this way, and i would need to fetch this information?
Is it available in the ID token?
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.