public void CreateRequestXASD() { string expect = TestData["XASDRequestBody.json"]; AccessToken token = new AccessToken() { Jwt = "eWaoksdijsdfeefes" }; XASDRequest request = new XASDRequest(token); string body = NewtonsoftJsonSerializer.Default.Serialize(request); Assert.AreEqual(body, expect); }
/// <summary> /// Authenticates to XASD (device.auth.xboxlive.com) via Windows Live AccessToken. /// NOTE: BROKEN /// </summary> /// <param name="accessToken">Windows Live access token</param> /// <returns>Returns the Xbox Live device token</returns> public static async Task <DeviceToken> AuthenticateXASDAsync(AccessToken accessToken) { logger.LogTrace("AuthenticateXASDAsync() called"); HttpClient client = ClientFactory("https://device.auth.xboxlive.com/"); var request = new HttpRequestMessage(HttpMethod.Post, "device/authenticate"); var requestBody = new XASDRequest(accessToken); request.Headers.Add("x-xbl-contract-version", "1"); request.Content = new JsonContent(requestBody); var response = (await client.SendAsync(request)).EnsureSuccessStatusCode(); var data = await response.Content.ReadAsJsonAsync <XASResponse>(); return(new DeviceToken(data)); }