Domanda

I am looking for a way to uniquely identify a user in WinRT and preferably in WP8 as well. In WP7 applications, I could get a hash of the Live ID to do this, but I am not sure of how to approach this in WinRT environment. One of the goals here is to identify the user in Windows 8 environment as a whole. Using LiveID in one form or another would be ok in this case. I found some sources but they also mentioned that this might require some Enterprise Security permissions (or such) that are not welcome in the Windows Marketplace.

Say I want to identify the user based on the live id, I want to do it automatically and across multiple devices (PC, Tablet, maybe WP8). What resources should I be looking for?

È stato utile?

Soluzione

You can obtain ID of each live user if you are using Live SDK. Here's code for you.

private async Task<string> GetLiveUserId()
{
    string ID = "";
    var auth = new LiveAuthClient();
    var loginResult = await auth.LoginAsync(new string[] { "wl.signin", "wl.basic" });
    if (loginResult.Status == LiveConnectSessionStatus.Connected)
    {
        var liveClient = new LiveConnectClient(loginResult.Session);
        var myData = await liveClient.GetAsync("me");
        ID =  myData.Result["id"].ToString();
    }

    return ID;
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top