What is the user id for /api/v2/users/{id} endpoint?

Here is what I am trying to do…

I implemented Twitter social login and it is working fine. However, I also want the access_token(which is generated by Twitter, not Auth0 I guess) to correspond to that user. After digging the docs I found this /api/v2/users/{id} endpoint. I have already generated access_token for management API and I’ll call the endpoint from my server.

I am using React and using the hooks. And here is the user object I am getting in the front-end.

{ "nickname": "Karunamay Murmu", "name": "Karunamay Murmu", "picture": "https://pbs.twimg.com/profile_images/875906814608539649/wrGtt_Qq_normal.jpg", "updated_at": "2022-02-13T14:40:11.652Z", "sub": "twitter|875905303245729793" }

I don’t get any id property If the id is supposed to be here. If not how I can get the ID?

Also, I didn’t understand the line below from the docs

The user becomes authenticated with the identity provider when an HTTP GET call to the /api/v2/users endpoint occurs.

Isn’t the user already authenticated when they authorize my app from Twitter as well as Auth0 during login?

Hello @Karunamay. The sub claim in the ID token is the user_id.

/api/v2/users/twitter%7C875905303245729793

2 Likes

Teamwork makes the dreamwork!