/// <summary>
        /// Sends a token request.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="request">The request.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns></returns>
        public static async Task <TokenResponse> RequestTokenAsync(this HttpMessageInvoker client, TokenRequest request, CancellationToken cancellationToken = default)
        {
            var clone = request.Clone();

            if (!clone.Parameters.ContainsKey(OidcConstants.TokenRequest.GrantType))
            {
                clone.Parameters.AddRequired(OidcConstants.TokenRequest.GrantType, request.GrantType);
            }

            return(await client.RequestTokenAsync(clone, cancellationToken).ConfigureAwait());
        }
        public static async Task <TokenResponse> RequestTokenAsync(this HttpMessageInvoker client, TokenRequest request, CancellationToken?cancellationToken = null)
        {
            Request request1 = request.Clone();

            if (!request1.Parameters.ContainsKey("grant_type"))
            {
                request1.Parameters.AddRequired("grant_type", request.GrantType, false);
            }
            ConfiguredTaskAwaitable <TokenResponse> configuredTaskAwaitable = HttpClientTokenRequestExtensions.RequestTokenAsync(client, request1, cancellationToken).ConfigureAwait(false);

            return(await configuredTaskAwaitable);
        }