Auth0 Home Blog Docs

Get UserId from login

Hi There,

We would like to get userID directly from login response header instead of making a separate request. What is the best way to do it. In swift SDK, it looks like completionBlock has credentials but it do not contain user id.

Thanks

Hey there Sean!

Can you provide me with more context around what you need the UserID for and why exactly this way?
Not sure yet if you can directly get it from login response header but will research it. As you mentioned for sure you can do it with Management API.

Thanks for your reply.Yes we are able to get UserID from profile. BTW, this user ID is generated on our side.

We will need userId for analytics purpose, since our logging system requires userID. We want to consolidate one call instead of login and getProfile two calls.

1 Like

Got it! Let me discuss it internally and get back to you!

So basically you can solve it by decoding the IdToken. The sub field in the idtoken contains userID

1 Like

Thanks, works great!

1 Like

Glad I was able to help!

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