Windows 8 Live SDK可以使用当前用户以外的其他Microsoft帐户吗? [英] Can the Windows 8 Live SDK use another Microsoft Account other than the current user?

查看:72
本文介绍了Windows 8 Live SDK可以使用当前用户以外的其他Microsoft帐户吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Windows 8 Live SDK,您可以让用户为其Microsoft帐户授予权限.有了这个,您可以获得他们的名字和照片等等.但是,使用Live SDK似乎要求应用程序的用户使用与登录Windows 8当前会话的用户相同的Microsoft帐户.

Using the Windows 8 Live SDK you can have a user give you permission to their Microsoft Account. With this you can get their name and photo and more. But using the Live SDK appears to require the user of the app to use the same Microsoft Account as whoever is signed into the current session of Windows 8.

在某些情况下,使用其他帐户是非常合法的.

In some scenarios, using a different account is very legitimate.

我的简单登录操作像个超级按钮!这使用相同的帐户.

I have simple sign-in working like a charm! This uses the same account.

我找不到使用另一种方法.有可能吗?

I can't find a way to do use another. Is it possible?

推荐答案

您可以在Init之后和LoginUser之前调用Logout.

You can call Logout after Init and before LoginUser.

这是javascript的代码:

Here's the code for javascript:

function LiveLogin(){
   WL.init("<<Your clientID goes here>>");

   if (WL.canLogout()) {
       WL.logout(function () {Callback(callback);});
   }
   else{
       Callback(callback);
   }
}

function Callback(){
WL.login({ scope: ["wl.signin", "wl.basic", "wl.emails"] }, function () {
        var session = WL.getSession();
        // do stuff with your session
    });
}

这是针对C#的:

LiveAuthClient liveAuthClient = new LiveAuthClient();
List<string> scopes = new List<string>();
scopes.Add("wl.signin");
scopes.Add("wl.basic");
scopes.Add("wl.emails");
LiveLoginResult loginResult = await liveAuthClient.InitializeAsync();
if (liveAuthClient.CanLogout)
{
    liveAuthClient.Logout();
}

loginResult = await liveAuthClient.LoginAsync(scopes);

对我有用. 我希望这就是您想要的.

It worked for me. I hope this is what you are looking for.

这篇关于Windows 8 Live SDK可以使用当前用户以外的其他Microsoft帐户吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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