Quantcast
Channel: Active questions tagged paypal - Stack Overflow
Viewing all articles
Browse latest Browse all 472

PayPal API - Authorization header does not have valid access token

$
0
0

I'm trying to use the PayPal API with this code to get a Valid Token:

var clientId = "yyyy";var secret = "xxxx";var client = new RestClient("https://api-m.sandbox.paypal.com/");client.AddDefaultHeader("Authorization", "Basic " +Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Format("{0}:{1}", clientId, secret))));var request = new RestRequest("v1/oauth2/token", Method.Post);request.AddParameter("grant_type", "client_credentials");var response = await client.ExecuteGetAsync(request);

But the response coming back is:

{"error":"invalid_token","error_description":"Authorization header does not have valid access token"}

Is there something I'm missing, when I use Postman, I have the exact same parameters filled in Postman with my C# code as well.


Viewing all articles
Browse latest Browse all 472

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>