Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Azure移动应用程序身份验证_C#_.net_Azure_Authentication_Uwp - Fatal编程技术网

C# Azure移动应用程序身份验证

C# Azure移动应用程序身份验证,c#,.net,azure,authentication,uwp,C#,.net,Azure,Authentication,Uwp,我正在使用Azure应用程序服务,我想使用Microsoft帐户验证我的用户,但在用户输入其凭据并获得“您已成功登录到网站”后,对话框不会关闭,也不会将控制权返回给我的UWP 这是我的密码: LiveLoginResult result = await liveIdClient.LoginAsync(new[] "wl.basic" }); if (result.Status == LiveConnectSessionStatus.Connected) { session = resu

我正在使用Azure应用程序服务,我想使用Microsoft帐户验证我的用户,但在用户输入其凭据并获得“您已成功登录到网站”后,对话框不会关闭,也不会将控制权返回给我的UWP

这是我的密码:

  LiveLoginResult result = await liveIdClient.LoginAsync(new[] "wl.basic" });

 if (result.Status == LiveConnectSessionStatus.Connected)
 {
session = result.Session;
var client = new LiveConnectClient(result.Session);
LiveOperationResult meResult = await client.GetAsync("me");

var provider = MobileServiceAuthenticationProvider.MicrosoftAccount;
user = await App.MobileService.LoginAsync(provider, true);

}
如果我从LoginAsync中删除“true”,我会得到一个异常,即:
身份验证响应的格式无效。

我认为您希望将Microsoft帐户与Live SDK一起用于登录,如果是,则
user=wait App.MobileService.LoginAsync(provider,true)不在这里

在此场景中,我们需要使用返回的令牌登录到您的移动应用后端:

MobileServiceUser loginResult = await App.MobileService
                .LoginWithMicrosoftAccountAsync(result.Session.AuthenticationToken);
user=wait App.MobileService.LoginAsync(提供者)方法用于使用Active Directory身份验证库进行身份验证,它们是不同的


你可以参考

我认为您希望使用Microsoft帐户和Live SDK进行登录,如果是这样,那么
user=wait App.MobileService.LoginAsync(provider,true)不在这里

在此场景中,我们需要使用返回的令牌登录到您的移动应用后端:

MobileServiceUser loginResult = await App.MobileService
                .LoginWithMicrosoftAccountAsync(result.Session.AuthenticationToken);
user=wait App.MobileService.LoginAsync(提供者)方法用于使用Active Directory身份验证库进行身份验证,它们是不同的


你可以参考

这将引发类型为的异常MobileServiceInvalidOperationException@MustafaSaeed,是否尝试替换
var provider=MobileServiceAuthenticationProvider.MicrosoftAccount;user=wait App.MobileService.LoginAsync(provider,true)MobileServiceUser loginResult=wait App.MobileService.loginWithMicrosoftAccountSync(result.Session.AuthenticationToken)进行代码>操作?@mustafaseed,此异常的消息是什么?@Grace Feng-MSFT请求无法完成。('authenticationToken'字段是必需的。)@MustaFaseed,这是用于身份验证的,使用Live SDK的Microsoft帐户,我看到您只想使用Microsoft帐户进行身份验证,那么您可以尝试
user=wait App.MobileService.LoginAsync(MobileServiceAuthenticationProvider.MicrosoftAccount)就像这样,不要使用Live SDK,我的意思是,删除其他代码。这个异常对我来说更像是一个服务问题MobileServiceInvalidOperationException@MustafaSaeed,是否尝试替换
var provider=MobileServiceAuthenticationProvider.MicrosoftAccount;user=wait App.MobileService.LoginAsync(provider,true)MobileServiceUser loginResult=wait App.MobileService.loginWithMicrosoftAccountSync(result.Session.AuthenticationToken)进行代码>操作?@mustafaseed,此异常的消息是什么?@Grace Feng-MSFT请求无法完成。('authenticationToken'字段是必需的。)@MustaFaseed,这是用于身份验证的,使用Live SDK的Microsoft帐户,我看到您只想使用Microsoft帐户进行身份验证,那么您可以尝试
user=wait App.MobileService.LoginAsync(MobileServiceAuthenticationProvider.MicrosoftAccount)就像这样,不要使用Live SDK,我的意思是,删除其他代码。这个异常对我来说更像是一个服务问题。