AnsweredAssumed Answered

/login/oauth2/token -  Status 400 Bad Request & message invalid code

Question asked by prasanna k on Mar 3, 2016

Hi,

Oauth2 token flow 3rd step

 

Status: 400 Bad Request

{"message":"invalid code"}

 

HttpClient client = HttpClientBuilder.create().build();

HttpPost post = new HttpPost(ConsumerUrl);

List<NameValuePair> urlParameters = new ArrayList<NameValuePair>();

urlParameters.add(new BasicNameValuePair("grant_type", "authorization_code"));

urlParameters.add(new BasicNameValuePair("client_id", clientId));

urlParameters.add(new BasicNameValuePair("client_secret", clientSecret));

urlParameters.add(new BasicNameValuePair("redirect_uri", contextPath));

urlParameters.add(new BasicNameValuePair("code", code));

post.setEntity(new UrlEncodedFormEntity(urlParameters));

return client.execute(post);

 

And for Https protocol facing time out error.

Outcomes