Authentication Failed - Sandbox
SS_2019
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Mar-27-2019
04:43 AM
We are currently trying to implement Seller onboarding using the PayPal docs however when we attempt to send the JSON request via JavaScript we are receiving the following error:
{"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"}]}
The auth header is being sent through as such:
xhr.setRequestHeader("Authorization", "Bearer OUR-ACCESS-TOKEN");
This token was generated via the steps on this docs page. We also tested it using the example shown here. This returned:
{total_count: 0, invoices: Array(0), links: Array(1)}
I'm assuming there can not be an error with the Authorization header line if it works for the prior. But then if that is the case I do not understand why this error is being recieved.
Full JS:
var xhr = new XMLHttpRequest(); var url = "https://api.sandbox.paypal.com/v1/customer/partner-referrals"; xhr.open("GET", url, true); xhr.setRequestHeader("Content-Type", "application/json"); xhr.setRequestHeader("Authorization", "Bearer OUR-ACCESS-TOKEN"); xhr.onreadystatechange = function () {
if (xhr.readyState === 4 && xhr.status === 200) { var json = JSON.parse(xhr.responseText); console.log(json); } }; xhr.send(data);
0 REPLIES 0

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- Error message for obtaining access_token in REST APIs
- NOT ENABLED TO VAULT PAYMENT SOURCE in Sandbox Environment
- p is not a function error using the example downloaded from Paypal in SDKs
- failed to pay with sandbox account in Sandbox Environment
- v2/payments/authorizations/{authorization_id} Request failed with status code 404 in REST APIs