Access user.email after login in my server nodeJS file not in my react file

I have a project to build a simple one to one video chat application where the problem statement is "A website where you can connect with your friends and have one to one video chat with them.
What I want to do is to add registration to the website which I have been able to do with Auth0. But, instead of using the random IDs, what I want is that the user’s unique email-id is used as the id and I enter the email id of another person who registers to connect the video call.
I have added the Auth0 authentication to the project but it is only on the react front. I want to access the user.email information after login inside my server nodeJS file as ID to connect to the socket.

I have very intermediate knowledge and my deadline is approaching, Can you please be kind enough and explain how to do the above. It would be very helpful. Thanking You. Regards.

Hi @sugata98,

Welcome to the Community!

You have a couple of options if you want to get the user’s email in your backend.

  • Send the email with the request you are making to the backend API.
  • Add the email to the access token you are sending to the API as a custom claim
  • Call the /userinfo endpoint with the access token to get the full user profile

Let me know if you have any questions,
Dan

Going by the third way, when I call the management API from my node backend, I need to provide the user ID in the URL explicitly. But, how can I programmatically get the user-id and put it in place of the url?

What endpoint are you calling? You shouldn’t be using the management API for the userinfo endpoint, you should be using the authentication API. Check the userinfo link I added in my previous reply for more info.

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