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.
- Need help to integrate PayPal Checkout (PPCP) with OpenCart? in PayPal Upgrade Community
- Direct credit card payment not working in paypal codeigniter in PayPal Payments Standard
- Need Help Upgrading to PayPal complete payments in PayPal Upgrade Community
- Payouts not working with live Credentials in REST APIs
- Trying to connect sandbox credentials in Magento 2.0 returns "Something went wrong." in Sandbox Environment