寻找通过Azure AD B2C进行身份验证的Xamarin Forms开发的Azure移动服务示例。我有一个工作解决方案,可以使用Xamarin Forms中的Azure B2C进行身份验证,但无法在Azure移动服务中使用生成的令牌。见下面的代码片段:Azure AD B2C Azure移动服务Xamrin表单示例
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);
任何和所有的想法,赞赏。
查看上面的代码更改: – sidsud
查看上面的代码更改:objToken.Add(“authenticationToken”,result.IdToken);已更改为objToken.Add(“access_token”,result.IdToken),并且我已将MobileServiceAuthenticationProvider.MicrosoftAccount更改为MobileServiceAuthenticationProvider.WindowsAzzureActiveDirectory – sidsud