sabre production api php - need help - Authentication failed due to invalid credentials
<p>I'm getting the following messages when calling the sabre rest API.</p>

<pre><code>array(3) { ["access_token"]=&gt; string(252) "my_accesstoken_was_here" ["token_type"]=&gt; string(6) "bearer" ["expires_in"]=&gt; int(604800) }
</code></pre>

<p><br></p>

<pre><code>array(5) { ["status"]=&gt; string(12) "NotProcessed" ["type"]=&gt; string(10) "Validation" ["errorCode"]=&gt; string(31) "ERR.2SG.SEC.INVALID_CREDENTIALS" ["timeStamp"]=&gt; string(29) "2016-10-17T07:06:40.053-05:00" ["message"]=&gt; string(48) "Authentication failed due to invalid credentials" } 
</code></pre>

<p>I followed the sabre documentation located here: <a href="https://developer.sabre.com/docs/read/rest_basics/authentication" rel="nofollow">https://developer.sabre.com/docs/read/rest_basics/authentication</a></p>

<p>I have no idea why I'm getting the invalid credentials message as I'm using the access token provided from the API call to sabre.</p>

<p>The following is my code. What is the issue?</p>

<pre><code>&lt;?php

//  get access token 
$client_id= base64_encode("V1:user:group:AA");
$client_secret = base64_encode("my_password");
$token = base64_encode($client_id.":".$client_secret);

$data='grant_type=client_credentials';


    $headers = array(
        'Authorization: Basic '.$token,
        'Accept: */*',
        'Content-Type: application/x-www-form-urlencoded'
    );

    $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL,"https://api.sabre.com/v2/auth/token");
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch,CURLOPT_POST,1);
    curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $res = curl_exec($ch);
    curl_close($ch);
    var_dump($resf = json_decode($res,1));
    $access_token = $resf['access_token']; // token provided from sabre
    $token_type = $resf['token_type'];
    $expires_in_seconds = $resf['expires_in'];

    // //  END get access token 

    // now to get api data using the provided access token
    $url = 'https://api.test.sabre.com/v1/shop/flights/fares?origin=jfk&amp;destination=lax&amp;lengthofstay=5&amp;pointofsalecountry=US';
    $headers2 = array(
    'Authorization: bearer '.$access_token,
    'protocol: HTTP 1.1 '
     );

    echo "&lt;br&gt;&lt;br&gt;";
    $ch2 = curl_init();
    curl_setopt($ch2,CURLOPT_URL,$url);
    curl_setopt($ch2,CURLOPT_HTTPHEADER,$headers2);
    curl_setopt($ch2,CURLOPT_RETURNTRANSFER,1);
    var_dump(json_decode(curl_exec($ch2),1));
    curl_close($ch2);


?&gt;
</code></pre>