I am trying to setup REST API client for Exact online Netherlands. I am using Oltu library for OAuth authorization. Here is my code:
OAuthAuthzResponse oar = OAuthAuthzResponse.oauthCodeAuthzResponse(httpReq);
String code = oar.getCode();
System.out.println(code);
OAuthClientRequest oAuthRequest;
oAuthRequest = OAuthClientRequest
.tokenLocation("https://start.exactonline.nl/api/oauth2/token")
.setGrantType(GrantType.AUTHORIZATION_CODE)
.setClientId("CLIEN_ID_HERE")
.setClientSecret("SECRET_HERE")
.setRedirectURI("http://localhost:8080/exact/returnTo")
.setCode(code)
.buildBodyMessage();
OAuthClient client = new OAuthClient(new URLConnectionClient());
OAuthJSONAccessTokenResponse oauthResponse = client.accessToken(oAuthRequest, OAuth.HttpMethod.POST);
LOGGER.info(oauthResponse.getAccessToken());
However, I am getting invalid_request error
org.apache.oltu.oauth2.common.exception.OAuthProblemException: invalid_request
at org.apache.oltu.oauth2.common.exception.OAuthProblemException.error(OAuthProblemException.java:59)
at org.apache.oltu.oauth2.client.validator.OAuthClientValidator.validateErrorResponse(OAuthClientValidator.java:63)
Can someone please me ?