cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
prakrisin
Community Member

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

Jump to solution

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.

1 Solution

Accepted Solutions
Stefanie
Community Team
Community Team

Hello  @prakrisin ​, is there a question in there? Smiley Happy I recommend that you elaborate upon this and re-post this in the Canvas Developers​ and/or Canvas Admins​ groups. Normally, I'd share it to one or both of those spaces myself, but since I haven't been able to discern the question in the post, in this case it would be better if you were to clarify the question and post it in the appropriate spot.

And, did you know that you can share a post in more than one community space? Once you have posted in one group (e.g. the Canvas Developers group), rather than having to create two copies with differing comment threads, you can create your post and then use the Share link in the upper right to share it into additional spaces. So if you join the Canvas Developers group, you can then share it into another group in which you are a member. That will keep the commentary unified in a single discussion.

View solution in original post

1 Reply
Stefanie
Community Team
Community Team

Hello  @prakrisin ​, is there a question in there? Smiley Happy I recommend that you elaborate upon this and re-post this in the Canvas Developers​ and/or Canvas Admins​ groups. Normally, I'd share it to one or both of those spaces myself, but since I haven't been able to discern the question in the post, in this case it would be better if you were to clarify the question and post it in the appropriate spot.

And, did you know that you can share a post in more than one community space? Once you have posted in one group (e.g. the Canvas Developers group), rather than having to create two copies with differing comment threads, you can create your post and then use the Share link in the upper right to share it into additional spaces. So if you join the Canvas Developers group, you can then share it into another group in which you are a member. That will keep the commentary unified in a single discussion.

View solution in original post