AnsweredAssumed Answered

error code 600 when trying to get access token

Question asked by 05c8e37621520cfb99fdce600dd2e1c73b7cb6e3 on Sep 3, 2018
Latest reply on Sep 3, 2018 by Sanford Whiteman

Hello community,


I have a small problem related to retrieving the access token using REST API. What is weird is that although everything works fine in the local environment, the story changes when using the same code on the testing environment. In WordPress I have this small piece of code:

$resourceUrl = $this->identityUrl.'oauth/token?grant_type=client_credentials&client_id=' . $this->clientId . '&client_secret=' . $this->clientSecret;
        $args = array(
            'headers' => array(
                'Accept' => 'application/json',
                'Content-Type' => 'application/json'
$response = wp_remote_get($resourceUrl, $args);


The problem here is that although on local server everything works ok, and I can retrieve the authentication token, on the testing server, this does not work, the resulting decoded json of the response being this:


  object(Requests_Utility_CaseInsensitiveDictionary)#1158 (1) {
    array(4) {
      string(5) "nginx"
      string(29) "Mon, 03 Sep 2018 09:18:57 GMT"
      string(30) "application/json;charset=UTF-8"
      string(3) "113"
  string(113) "{"requestId":"e097#1659eba5b83","success":false,"errors":[{"code":"600","message":"Access token not specified"}]}"
  array(2) {
    string(2) "OK"
  array(0) {
  object(WP_HTTP_Requests_Response)#1167 (5) {
    object(Requests_Response)#1155 (10) {
      string(113) "{"requestId":"e097#1659eba5b83","success":false,"errors":[{"code":"600","message":"Access token not specified"}]}"
      string(270) "HTTP/1.1 200 OK
Server: nginx
Date: Mon, 03 Sep 2018 09:18:57 GMT
Content-Type: application/json;charset=UTF-8
Content-Length: 113
Connection: close


What I find weird is that it says that no access token was specified, even though that is exactly what I required to receive. Is there something I'm missing here? Thank you.