Luis_Saiz | 2019-01-15 14:56:43 UTC | #1
Hi,
I am trying to get the access token using SoapUi, but i am always getting a bad request. I am using the client credentials grant and I have tested that postman is getting the token without any problem using the same data so I assume SoapUi is changing something in my request.
Request: POST https://login.mypurecloud.ie/oauth/token HTTP/1.1 granttypes: clientcredentials Content-Type: application/x-www-form-urlencoded Authorization: Basic {TREAT YOUR AUTH TOKEN LIKE A PASSWORD} Content-Length: 0 Host: login.mypurecloud.ie Connection: Keep-Alive User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Response HTTP/1.1 400 Bad Request Content-Type: application/json Date: Tue, 15 Jan 2019 10:35:52 GMT Inin-Correlation-Id: c5e65a05-8bf3-4aed-5a60-745312edbad5 Strict-Transport-Security: max-age=7776000 Content-Length: 28 Connection: keep-alive
{"error":"invalid_request"}
What I am missing?
Thank you
Regards
anon28066628 | 2019-01-15 14:55:36 UTC | #2
Please see here: https://developer.mypurecloud.com/api/rest/authorization/use-client-credentials.html
The required headers are Content-Type (application/x-www-form-urlencoded) and Authorization. The required form body is:
granttype=clientcredentials
You've misspelled granttype as "granttypes".
You also should immediately delete your OAuth client configured in PureCloud, as you've exposed the encoded ID and Secret here, potentially giving others access to your org. Please anonymize any credential or token details posted here.
Luis_Saiz | 2019-01-15 16:06:04 UTC | #3
Hi Smith,
I must have made a mistake when typing the header
Thank you for your reply.
Regards
system | 2019-02-15 16:06:04 UTC | #4
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: 4347