0
votes

I'm facing an interesting challenge as I'm setting up a brand new instance of an Azure Mobile App connected to an existing DB of an existing Azure Mobile Services running in production.

The app running in production with AMS has Microsoft Account authentication and we filter user'data server-side using the context.userid field. This field looks like MicrosoftAccount:abcdef....

After setting up a new Azure Mobile App with Microsoft authentication support, I'm getting a userId that is different, something like sid:ABC...

Using the documentation, I was able to get more details about user identity using the getIdentity() api:

context.user.getIdentity().then((data) => { });

But I'm still unable to find the "old" UserId that was used in the AMS world... and therefore I cannot have link between the existing data and the new app.

Any idea ?

1

1 Answers

0
votes

I wonder if context.userid exactly means the email address. However, you can get the account email of the logged in user with the following.

context.user.getIdentity().then(function (userInfo) {
    var userId = userInfo.aad.claims.emailaddress;
});