glennzh | 2018-06-04 15:21:14 UTC | #1
I can get the code but when get access token by code, it throws error 400. I have follow the steps of /api/rest/authorization/use-authorization-code.html
I also use the python sample code to run and get the same error.
Below is the postman test.
post to https://login.mypurecloud.com.au/oauth/token
header: Authorization:Basic xxxxxxxxxx () content-type:application/x-www-form-urlencoded
Body: granttype:authorizationcode code:zjfvnI2cVptStGnh3fQ0ASOPqSkiYdJ5iPuS1WXhDA redirecturi:http://teleapps.net:8000/dashboard/
Error 400 { "error": "invalid_request" } Inin-Correlation-Id →81d5f74e-b193-4fe5-bf8e-7e2d80804a62
tim.smith | 2018-06-04 20:21:44 UTC | #2
The body isn't right. Be sure to use the proper format for form encoded data in a POST request. See https://developer.mypurecloud.com/api/rest/authorization/use-authorization-code.html for an example HTTP request.
glennzh | 2018-06-05 09:48:01 UTC | #3
Connection →keep-alive Content-Length →28 Content-Type →application/json Date →Tue, 05 Jun 2018 09:43:36 GMT Inin-Correlation-Id →0cc9cf2d-599e-4ff0-af0f-9e08629ede89 Strict-Transport-Security →max-age=7776000
glennzh | 2018-06-05 09:46:04 UTC | #4
Connection →keep-alive Content-Length →28 Content-Type →application/json Date →Tue, 05 Jun 2018 09:43:36 GMT Inin-Correlation-Id →0cc9cf2d-599e-4ff0-af0f-9e08629ede89 Strict-Transport-Security →max-age=7776000
glennzh | 2018-06-05 09:47:50 UTC | #5
Connection →keep-alive Content-Length →28 Content-Type →application/json Date →Tue, 05 Jun 2018 09:47:03 GMT Inin-Correlation-Id →863d1e59-1805-4f53-bf81-9d5bb6cfe213 Strict-Transport-Security →max-age=7776000
glennzh | 2018-06-05 09:50:41 UTC | #6
Both body content have correct auth code. However, No luck. Please help
tim.smith | 2018-06-05 12:35:22 UTC | #7
What kind of response are you getting?
Try using the x-www-form-urlencoded body type since the body is supposed to be form encoded.
glennzh | 2018-06-05 13:26:36 UTC | #8
Connection →Close Content-Length →28 Content-Type →application/json Date →Tue, 05 Jun 2018 13:25:22 GMT Inin-Correlation-Id →ba9b0a89-946e-4f5a-9f92-b86f099ab942 Strict-Transport-Security →max-age=7776000
glennzh | 2018-06-05 13:27:17 UTC | #9
error 400 bad request
glennzh | 2018-06-05 13:28:20 UTC | #10
glennzh | 2018-06-07 02:26:08 UTC | #11
Please help, any solution?
tim.smith | 2018-06-07 13:14:37 UTC | #12
You're still not sending a valid request. Please refer to the example request in the Grant - Authorization Code documentation. You must send the request exactly as documented. This includes sending a properly form-encoded body. Your examples have all been visibly different from the example in the documentation thus far.
tim.smith | 2018-06-07 13:16:33 UTC | #13
Also, you could try configuring the auth code grant using Postman's Authorization OAuth2 configuration. There's nothing wrong with doing it manually, but Postman has tools to help with this.
system | 2018-07-08 13:16:37 UTC | #14
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 2949