0

I tried to write a curl with a scope but I have always an error come from the application. All the rights are open.

Maybe I do something wrong

      $curl = curl_init($this->Url . 'api' . $endpoint);
      curl_setopt_array($curl, array(
        CURLOPT_RETURNTRANSFER => TRUE,
        CURLOPT_USERAGENT => "MyUserAgent/1.0",
        CURLOPT_HTTPHEADER => array("Authorization: Bearer 6a957ad3fec7dc151b8fa9c5dcb7e63a_c56249107a5097e7a69781e892fd883ccd040fc5e37cf2220ec12d2b238aec8d"),
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => array("scope" => "profile")
      ));
      $response = curl_exec($curl);
var_dump($response);

response : { "errorCode": "3S290\/B", "errorMessage": "NO_SCOPES" }" 

Thank you.

Sammitch
  • 30,782
  • 7
  • 50
  • 77
yostijognu
  • 19
  • 3
  • 1
    This has nothing to do with CURL, it is working properly. The error is being returned from the API endpoint. I would wager that you're posting the scope variable in the wrong format. Curl will default to `application/x-www-form-urlencoded`, eg: `scope=profile`, and [just going by what's popular today] your app probably wants JSON like `{"scope": "profile"}`. Check the API docs. – Sammitch Jan 16 '23 at 21:00

0 Answers0