Example #1
0
        public static Task <PKCETokenResponse> RequestToken(PKCETokenRequest request, IAPIConnector apiConnector)
        {
            Ensure.ArgumentNotNull(request, nameof(request));
            Ensure.ArgumentNotNull(apiConnector, nameof(apiConnector));

            var form = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("client_id", request.ClientId),
                new KeyValuePair <string, string>("grant_type", "authorization_code"),
                new KeyValuePair <string, string>("code", request.Code),
                new KeyValuePair <string, string>("redirect_uri", request.RedirectUri.ToString()),
                new KeyValuePair <string, string>("code_verifier", request.CodeVerifier),
            };

            return(SendOAuthRequest <PKCETokenResponse>(apiConnector, form, null, null));
        }
Example #2
0
 /// <summary>
 /// Requests a new token using pkce flow
 /// </summary>
 /// <param name="request">The request-model which contains required and optional parameters.</param>
 /// <remarks>
 /// https://developer.spotify.com/documentation/general/guides/authorization-guide/#authorization-code-flow-with-proof-key-for-code-exchange-pkce
 /// </remarks>
 /// <returns></returns>1
 public Task <PKCETokenResponse> RequestToken(PKCETokenRequest request)
 {
     return(RequestToken(request, API));
 }