使用Live SDK使用Microsoft帐户登录 [英] Login with Microsoft account using Live SDK

查看:120
本文介绍了使用Live SDK使用Microsoft帐户登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建Windows 8.1应用程序,并且希望将其用于多个帐户.当我第一次启动该应用程序时,我使用了wl.signin范围来更快地测试该应用程序,但是现在我想使用其他帐户进行测试.因此,我删除了此作用域,从计算机上卸载了该应用程序,并从我的真实帐户中删除了该应用程序的权限.

I am creating a Windows 8.1 application, and I want to use it with multiple accounts. When I first started the application, I used the wl.signin scope to test the app faster, but I want to test now with other account(s). So I deleted this scope, I uninstalled the app from my computer, and from my Live Account I removed the apps permissions.

仍然,如果我想首次登录,则应用程序需要获得自动登录的权限(== wl.signin,我已经从我的范围中删除了它,正如我之前提到的).

Still, if I want to log in for the first time, the app wants permission for automatic login(== wl.signin, which I deleted from my scopes already as I mentioned before).

基本上,我希望每次使用该应用程序时都能写出我的用户凭据,以便我可以使用其他帐户登录.

Basically, I want to achieve to write my user credentials every time I want to use the app so I could login with other accounts.

这是登录代码:

LiveLoginResult result = await App.Auth.InitializeAsync(new string[] { "wl.basic" });
if (result.Status != LiveConnectSessionStatus.Connected)
    result = await App.Auth.LoginAsync(new string[] { "wl.basic" });

if (result.Status == LiveConnectSessionStatus.Connected)
{
    await App.MobileService.LoginWithMicrosoftAccountAsync(
        result.Session.AuthenticationToken);
    App.Lcs = result.Session;                    
}
else
{
    await dialogService.ShowMessage("Not logged in.", "Error!");
}

如果我尝试注销,则CanLogout总是返回false值.

And if I try to log out, the CanLogout always returns with false value.

if (App.Auth.CanLogout)
{
    App.Auth.Logout();
    navigationService.NavigateTo("MainPage");
}

我在这里想念什么?范围可能缓存在其他地方吗?如果我将操作系统与Microsoft帐户一起使用,可能会出现问题吗?或者,如果我将应用程序与带有Visual Studio的商店应用程序相关联?

What am I missing here? Maybe the scopes cached somewhere else? Could that be a problem if I use the operating system with Microsoft Account? Or if I associated the app with a Store app with Visual Studio?

推荐答案

LiveSdk无法实现.因为LiveSdk使用系统中的帐户信息.一次使用少量帐户的唯一方法是通过LIVE REST API(如内部的LiveSDK)开发自己的SDK.

It's not possible with LiveSdk. Because LiveSdk uses account info from the system. The only way to use few accounts at once, is to develop an own SDK via LIVE REST API (as in the LiveSDK internally).

这篇关于使用Live SDK使用Microsoft帐户登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆