Reputation: 233
In Azure Mobile App server, with client initiated authentication on device, we get userid (aka sid), now when I want to create a user record using mobile app service the sid is not available for the first time. Only information I have at the backend is, by reading claims with "NameIdentifier".
string uniqueId = creds.UserClaims.FirstOrDefault(c => c.Type.Equals(ClaimTypes.NameIdentifier))?.Value;
SO I am curious whether is this the right way to get user id?
Upvotes: 1
Views: 591
Reputation: 8035
Yes, this is the right way to get the user claims. For more information, check out Chapter 2 of my book: https://adrianhall.github.io/develop-mobile-apps-with-csharp-and-azure/chapter2/authorization/
Upvotes: 1