Can the Windows 8 Live SDK use another Microsoft Account other than the current user?

眉间皱痕 提交于 2019-12-02 02:56:20

You can call Logout after Init and before LoginUser.

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
    });
}

And this is for 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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!