Error requesting access token API-REST

Good Afternoon, Requesting your support with the following topic:
We create an integration with SugaCRM through an API-REST.
The detail is that we are trying to obtain an authentication token from SugarCRM with the endpoint /rest/v11/oauth2/token using the authorization protocol: OAuth2

However we get the following response:
Error requesting access token
403 Forbidden
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access this resource.</p>
</body></html>

We have proceeded with the following points
1. Token request from Postman which is correct.
2. Access credentials have been verified and are correct.
3. The connection user is “Active”.
Is there something we need to consider?
Thanks for your help.

Parents
  • <?php
    
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
      CURLOPT_URL => 'https://{url}/rest/{version}/oauth2/token',
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => '',
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 0,
      CURLOPT_FOLLOWLOCATION => true,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_POSTFIELDS =>'{
      "grant_type" : "password",
      "username" : "****",
      "password" : "***",
      "client_id" : "sugar",
      "client_secret" : "",
      "platform" : "opi"
    }',
      CURLOPT_HTTPHEADER => array(
        'Content-Type: application/json', 
      ),
    ));
    
    $response = curl_exec($curl);
    
    curl_close($curl);
    echo $response;

    Rodrigo Manara

    Sr. Developer

Reply
  • <?php
    
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
      CURLOPT_URL => 'https://{url}/rest/{version}/oauth2/token',
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => '',
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 0,
      CURLOPT_FOLLOWLOCATION => true,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_POSTFIELDS =>'{
      "grant_type" : "password",
      "username" : "****",
      "password" : "***",
      "client_id" : "sugar",
      "client_secret" : "",
      "platform" : "opi"
    }',
      CURLOPT_HTTPHEADER => array(
        'Content-Type: application/json', 
      ),
    ));
    
    $response = curl_exec($curl);
    
    curl_close($curl);
    echo $response;

    Rodrigo Manara

    Sr. Developer

Children
No Data