Azure Mobile Service and Azure Web App authentication

Viewed 699

I get two different SID for the same user when the user is logging in through a Azure Web App (ASP.NET MVC) and Xamarin.iOS app

Setup

Azure WebApp ASP.NET 5 with API Controllers

Xamarin iOS App with Microsoft.WindowsAzure.Mobile.Client SDK Azure B2C AAD

User on Web

I get the ObjectIdentifier value that is the AAD SID:

var userClaim = ClaimsPrincipal.Current.FindFirst("http://schemas.microsoft.com/identity/claims/objectidentifier").Value;

User on Mobile

I get only a Nameidentifier value and no ObjectIdentifier

ClaimsPrincipal mobileUser = this.User as ClaimsPrincipal;
var mobileUserClaim = mobileUser.FindFirst("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier");

The SID is completely different, the SID for the user authenticate from Mobile get SID:xxxx while from Web gets xxx

I know if I setup one Azure Mobile App and one Azure Web App the SID is the same when authenticating. But I dont want to manage two sites for the size (small) of my App. The purpose of the App is to have a Simple Web App to perform some actions and the same actions on the Phone, from the Phone I use the Azure Mobile Service SDK and InvokeAPIAsync to use the API controller in the Web App.

Thanks

2 Answers
Related