'PayPal Sandbox API alway results in Unauthorized error
I have created a test sandbox app and took the Client ID and Secret and ran the call
curl -v POST https://api-m.sandbox.paypal.com/v1/oauth2/token \
-H "Accept: application/json" \
-H "Accept-Language: en_US" \
-u "CLIENT ID:SECRET" \
-d "grant_type=client_credentials"
I get the access_token from the response which I then use to try and run some basic API calls, such as
curl -v -X GET https://api-m.sandbox.paypal.com/v1/reporting/transactions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer access_token"
But no matter which API call I make, I am always seeing some sort of unauthorized message (depending on the API that I called).
Any ideas? Am I missing something here? From what I figure, I should be able to make authorized API calls.
UPDATE
Here is an example of the response I get from a transactions call
{"name":"AUTHENTICATION_FAILURE","message":"Authentication failed due to invalid authentication credentials or a missing Authorization header.","links":[{"href":"https://developer.paypal.com/docs/api/overview/#error","rel":"information_link"}]}
Here is the response I get form a Payouts call...
{"name":"AUTHORIZATION_ERROR","message":"Authorization error occurred.","debug_id":"cfde17663b411","information_link":"https://developer.paypal.com/docs/api/payments.payouts-batch/#errors","links":[]}
I don't get an authorization error when calling the catalogs/product call...
{"products":[],"links":[{"href":"https://api.sandbox.paypal.com/v1/catalogs/products?page_size=10&page=1","rel":"self","method":"GET"}]}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
