REST API Payments get error 401 UNAUTHORIZED in live credentials
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
REST API Payments get error 401 UNAUTHORIZED , When using live credentials, in testing credentials all working ok
- Labels:
-
API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you ever find a solution to this bug? Please share if you did.
I've been pulling my hair out for weeks on this one and there are no answers anywhere.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I had the same problem and solve as following:
// set config
Dictionary<string,string> config = new Dictionary<string,string>();
config.Add("mode", "live");
config.Add("clientId", "xxx");
config.Add("clientSecret", "xxx");
var accessToken = new OAuthTokenCredential(config).GetAccessToken(); // get the GetAccessToken with the config
var apiContext = new APIContext(accessToken);
apiContext.Config = config; // no need in "sandbox" mode, but need in "live" mode
hope it helps

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you use REST, you need to use the Client ID and Secret when requesting an access token, in order to do all the API calls your account is able to.
https://developer.paypal.com/docs/api/overview/#authentication-and-authorization
Kind Regards,
Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, as Jeckoso said... I'm using MVC and in my Web.config file, I have the ClientID and the Secret but there is a third argument called mode which can be 'sandbox' or 'live'. Going with live credentials with the mode sandbox will throw the not authorized exception.

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- How can I revoke SamCart's access my recurring payments? in NVP/SOAP APIs
- How to integrate PayPal during user signup to avoid re-entering credentials for future payments? in REST APIs
- I keep getting the error: “Unfortunately, a system error has occurred" in NVP/SOAP APIs
- ExpressCheckout to REST API - Is Partner Program Now Required to Host Simple 3rd Party Transactions? in REST APIs
- Need advice on Account / Donations / Payouts / technical issues in Sandbox Environment