The implementation of GetExternalLoginInfoAsync is different from LiveAuthClient.GetUserId (authToken)?

Can someone help shed light on the implementation of the Live SDK (v5.6) compared to what is happening in Microsoft.AspNet.Identity.Owin.dll?

The user ID returned after successful authentication is as follows:

//MVC5 UserController for SSO with Microsoft Account
var result = await AuthenticationManager.GetExternalLoginInfoAsync();
var userId = result.Login.ProviderKey;

... different from the returned identity:

//WebAPI 2 custom AuthFilter (performs HMAC, etc)
var liveAuthClient = new LiveAuthClient(clientKey, secretKey, redirectUrl);
var userId = liveAuthClient.GetUserId(authTokenFromHttpHeader);

In both cases, the same ClientId and ClientSecret are used by the Windows Phone 8, MVC5 WebApp, and WebAPI 2 client applications.

The identifier returned by the MVC5 website is 16 characters long, while the identifier retrieved from the authentication token is 32 characters.

I thought that perhaps the identifier from the client application is an MD5 hash, however they still do not match if I try to use it.

Any ideas?

+4
1

- , , , , LiveAuthClient, Live SDK, , .

WebAuthenticationBroker WP8.1 Silverlight, https://login.live.com/oauth20_authorize.srf?client_id=the_clientid&scope=wl.signin&response_type=token&display=touch ( "the_clientid" ClientID), access_token, :

//get the UID
var accessToken = "the_token"; //replace with actual token
var meUri = new Uri(string.Format("https://apis.live.net/v5.0/me/?access_token={0}", accessToken));

var httpClient = new HttpClient();               
var response = await httpClient.GetAsync(meUri);
var responseString = await response.Content.ReadAsStringAsync();
var meObj = new { Id = ""};

meObj = JsonConvert.DeserializeAnonymousType(responseString, meObj);

meObj.Id MD5, ProviderKey, - MVC5!

, , WebAuthenticationBroker:

http://msicc.net/?p=4054 (Windows Runtime Apps)

http://msicc.net/?p=4074 ( Silverlight 8.1)

+1

Source: https://habr.com/ru/post/1548404/


All Articles