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oKPQ"; response.AccessToken = "access-token"; response.ExpiresIn = 3599; response.CorrelationId = "correlation-id"; response.RefreshToken = "refresh-token"; response.FamilyId = "1"; response.Scope = "scope1 scope2"; response.TokenType = "Bearer"; AuthenticationResultEx resultEx = response.GetResultEx(); Assert.IsNotNull(resultEx); Assert.AreEqual("access-token", resultEx.Result.Token); Assert.AreEqual("scope1 scope2", resultEx.Result.ScopeSet.AsSingleString()); Assert.AreEqual("Bearer", resultEx.Result.TokenType); }
private async Task <AuthenticationResultEx> SendHttpMessageAsync(IRequestParameters requestParameters) { string endpoint = this.Authenticator.TokenUri; endpoint = AddPolicyParameter(endpoint); var client = new MsalHttpClient(endpoint, this.CallState) { Client = { BodyParameters = requestParameters } }; TokenResponse tokenResponse = await client.GetResponseAsync <TokenResponse>(ClientMetricsEndpointType.Token).ConfigureAwait(false); AuthenticationResultEx resultEx = tokenResponse.GetResultEx(); if (resultEx.Result.ScopeSet == null || resultEx.Result.ScopeSet.Count == 0) { resultEx.Result.ScopeSet = this.Scope; PlatformPlugin.Logger.Information(this.CallState, "Scope was missing from the token response, so using developer provided scopes in the result"); } return(resultEx); }