New to the community? Welcome! Please read our Community Rules and Guidelines
REST API Payments get error 401 UNAUTHORIZED , When using live credentials, in testing credentials all working ok
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.
I had the same problem and solve as following:
// set config
Dictionary<string,string> config = new Dictionary<string,string>();
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
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.