Search code examples
paypalpaypal-sandbox

PayPal Checkout.js: Authentication failed due to invalid authentication credentials or a missing Authorization header


We've been running payments through PayPal Checkout.js successfully for about 5 years on several client accounts, but since yesterday we've noticed clients receiving the following error (in the console) when their customers click the "pay with PayPal" button at checkout:

"Authentication failed due to invalid authentication credentials or a missing Authorization header"

Double-checking their Live Client ID and Sandbox Client ID credentials, everything looks correct.  The error does NOT show in Sandbox mode, only in Live mode.

For reference, the entire log in the console is:

checkout.js:6484 Uncaught Error: Request to post https://www.paypal.com/v1/payment-experience/web-profiles failed with 401 error. Correlation id: f5501848d84a8

{
"name": "AUTHENTICATION_FAILURE",
"debug_id": "f5501848d84a8",
"message": "Authentication failed due to invalid authentication credentials or a missing Authorization header",
"information_link": "https://developer.paypal.com/docs/api/payment-experience/#errors",
"details": []
}

Interestingly, if we change the Live Client ID to something incorrect, the error returned changes to:

checkout.js:7123 Uncaught Error: Error: Request to post https://www.paypal.com/v1/oauth2/token failed with 401 error. Correlation id: f633416cb9298

{
"error": "invalid_client",
"error_description": "Client Authentication failed"
}

This would hint that the error lies with "a missing Authorization header" as noted in the original error, but as far as I know the paypal.Button.render JS call doesn't allow editing or passing headers directly, only sending the "client" parameter with the sandbox and production client IDs.

Since this was working fine a couple of days ago, and we are using the same exact code and credentials as when it was working, I'm guessing something external is causing this. Could it be that something in the PayPal button API changed recently that we missed?  Any help would be greatly appreciated!

Thanks,

Michael


Solution

  • This ended up being an issue by the provider and was fixed by PayPal two days later. The full thread on the issue and the fix is located here: https://www.paypal-community.com/t5/Sandbox-Environment/Authentication-failed-due-to-invalid-authentication-credentials/m-p/2954476