Search code examples
node.jsxamarin.formsazure-mobile-services

Get user info like name, email Id etc from authentication token in Node.JS Backend Mobile Service


I'm trying to construct this following solution - https://social.msdn.microsoft.com/Forums/azure/en-US/2d527121-42dd-4ed3-a68f-a70ad0a36c0d/get-user-info-like-name-email-id-etc-from-authentication-token-in-net-backend-mobile-service?forum=azuremobile&prof=required

This is based on C# solution. Since we are new on this Azure Mobile App, we are taking the approach of using Node.JS instead as per Quick Start solution/Xamarin doco.

How do we turn this into node.JS backend then?

Thanks


Solution

  • You can use the App Service Authentication/Authorization feature for this.

    Retrieving the email from the auth token also depends on the authentication source. For example, if you are using MSA, the email is not part of the claim. Please refer my blog post on how to add the email field in the claim in case of MSA. https://blogs.msdn.microsoft.com/kaushal/2016/04/01/azure-web-apps-how-to-retrieve-user-email-in-the-claim-when-using-microsoft-account-as-a-provider-in-easy-auth/