Suchen Sie nach einem Beispiel für Azure Mobile Services, das in Xamarin Forms entwickelt wurde und über Azure AD B2C authentifiziert wird. Ich habe eine funktionierende Lösung, mit der ich Azure B2C in Xamarin-Formularen authentifizieren kann, aber das resultierende Token in Azure Mobile Services nicht verwenden kann. Siehe Code-Schnipsel unten:Azure AD B2C Azure Mobile Dienste Xamrin Forms Beispiel
public static PublicClientApplication AuthenticationClient { get; private set; }
public static MobileServiceClient MobileService = new MobileServiceClient(Constants.MobileServiceClientName);
result = App.AuthenticationClient.AcquireTokenAsync(
Constants.Scopes,
string.Empty,
UIBehavior.SelectAccount,
string.Empty,
null,
Constants.Authority, null);
JObject objToken = new JObject();
objToken.Add("authenticationToken", result.IdToken);
//I am successfully able to get an Id token for Microsoft, Google and Twitter providers but when I use the token to login to my Azure Mobile Service app, I get a "Not Authorized" error
MobileServiceUser user = await MobileService.LoginAsync(MobileServiceAuthenticationProvider.MicrosoftAccount, objToken);
Alle und alle Ideen werden geschätzt.
Siehe Codeänderungen zu dem oben genannten: – sidsud
Siehe Codeänderungen zu obigem: objToken.Add ("authenticationToken", result.IdToken); wurde in objToken.Add ("access_token", result.IdToken) geändert und ich habe MobileServiceAuthenticationProvider.MicrosoftAccount in MobileServiceAuthenticationProvider.WindowsAzzureActiveDirectory geändert. – sidsud