I'm trying to retrieve the access token after going through the redirect process mentioned here https://developer.authorize.net/api/reference/features/oauth.html
Code and client_id have been changed to protect the innocent.
HttpRequest req = new HttpRequest();
req.setEndpoint(https://accesstest.authorize.net/oauth/v1/token?code=XXXX&grant_type=authorization_code&client_id=XXXXXX&platform=2">);
req.setMethod('POST');
req.setHeader('Content-Type', 'application/x-www-form-urlencoded');
req.setHeader('v-c-client-correlation-id', 'unique id');
HttpResponse res = new HttpResponse();
res = new HTTP().send(req);
The response I get back in the body is
{"error":"invalid_request","error_description":"The requested redirectUri does not match"}
If I change the 'code' value I get
{"error":"invalid_request","error_description":"Invalid authorization code"}
which makes sense so it seems like it's accessing the accounts correctly.
Does anyone have an idea of what's going on?
Thanks