I am trying to call this API (Oauth1.0 standard):
https://appcenter.intuit.com/api/v1/Connection/Reconnect
And what I am doing is : (It am working on java)
Base64Encoder baseEncoder = Base64Encoder.getInstance();
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet("https://appcenter.intuit.com/api/v1/connection/reconnect");
StringBuilder headerReq = new StringBuilder();
headerReq.append("OAuth ");
headerReq.append("oauth_token=\"").append(OAUTHTOKEN).append("\"");
headerReq.append(", oauth_consumer_key=\"").append(CUNSUMER_KEY).append("\"");
headerReq.append(", oauth_signature_method=\"base64\"");
headerReq.append(", oauth_signature=\"") .append(baseEncoder.encode(PropsUtil.get(OAUTH_CONSUMER_SECRET).getBytes()))
.append(baseEncoder.encode("&".getBytes())) .append(baseEncoder.encode(symmetricEncrypter.decryptData(OAUTH_TOKEN_SECRET).getBytes())).append("\"");
headerReq.append(", oauth_version=\"1.0\"");
httpGet.addHeader("Authorization", headerReq.toString());
CloseableHttpResponse response = httpclient.execute(httpGet);
try {
System.out.println("Responsee::"+ response.getStatusLine());
}
And, the response what I am getting is:
<?xml version="1.0" encoding="utf-8"?>
<PlatformResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://platform.intuit.com/api/v1">
<ErrorMessage>This API requires Authorization.</ErrorMessage>
<ErrorCode>22</ErrorCode>
Can you please suggest me what I am missing while creating request for Oauth1.0 standard or Please, anyone can provide me the sample code of Oauth1.0 request example on that standard.
Thank you very much.
PFB working code. Hope it will be useful.
Dependencies
Thanks
This is the working HTTP GET requestcode in java when all keys are in hand. Hope it does your work.