Stan | 2017-06-16 02:29:08 UTC | #1
String encodeData = new String(Base64.encodeBase64((clientId+":"+clientSecret).getBytes("ISO-8859-1")));
HttpClient client = HttpClients.createDefault(); HttpPost httpPost = new HttpPost("https://login.mypurecloud.jp/oauth/token"); httpPost.addHeader("Authorization", " Basic " + encodeData); httpPost.addHeader("Content-Type", "application/x-www-form-urlencoded"); httpPost.addHeader("granttype", "clientcredentials"); HttpResponse response = client.execute(httpPost);
It returns 400, is there anything wrong with my code?
Stan | 2017-06-16 05:16:36 UTC | #2
Sorry,it has been solved.
tim.smith | 2017-06-19 19:22:20 UTC | #3
Glad you got your issue resolved. For future reference, there are several code examples for how to base64 encode your client ID and secret: https://developer.mypurecloud.com/api/rest/authorization/base-64-encoding.html
system | 2017-08-28 19:35:08 UTC | #4
This post was migrated from the old Developer Forum.
ref: 1421