Hi,
I've been facing issue in calling https://login.eloqua.com/auth/oauth2/token endpoint.. I've tried multiple solutions but can not figure it out... Below is the java code that I'm using to accomplish this:
List<BasicNameValuePair> lst = Arrays.asList( new BasicNameValuePair("code", authKey), new BasicNameValuePair("grant_type", "authorization_code"), new BasicNameValuePair("redirect_uri", "https://qa.at-event.com/login")); String auth = "basic " + Base64.encodeBase64String((clientId + ":" + clientSecret).getBytes()); HttpResponse resp = null; try { resp = Request.Post("https://login.eloqua.com/auth/oauth2/token") .addHeader("Authorization" , auth) .addHeader("Accept" , "application/json") .addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8") .bodyForm(lst).execute().returnResponse(); System.out.println("The Fetch Token resp => {}"+ resp); StatusLine s = resp.getStatusLine(); System.out.println("reason::"+s.getReasonPhrase()); System.out.println("Status Code::" +s.getStatusCode());
But it always return me HTTP/1.1 400 Bad Request error without giving any other details. Answers to a few commonly asked questions:
> Yes, I'm providing correct client id and client secret
> I am providing Exact URI in the callback URI property in application configuration and in the redirect URI in code.
> I made sure that authorization code does not get expired by calling the authorize service multiple times and trying this code right after that.
I'll highly appreciate if anyone can come up with any suggestion, because I'm really stuck here...
Thanks,
Rubab.