PHP Guzzle with basic auth and token icon

I am trying to establish a connection with infojobs-api, an explanation of the documentation on how to do this as follows:

GET / api / 1 / application HTTP / 1.1
Host: api.infojobs.net Authorization: Primary QWxhZGRpbjpvcGVuIHNlc2FtZQ ==, Media 07d18fac-77ea-461f-9bfe-a5e9d98deb3d

( https://developer.infojobs.net/documentation/user-oauth2/index.xhtml )

And this is my code:

$basicauth = new Client(['base_uri' => 'https://api.infojobs.net']);

$credentials = base64_encode(CLIENT_ID .':' . CLIENT_SECRET ) ;

$newresponse = $basicauth->request(
  'GET',
  'api/1/curriculum',
  ['debug' => true], 
  ['auth' => 
    ['Basic', $credentials] ,
    ['Bearer', $acceso->access_token]
  ]
)->getBody()->getContents();

d($newresponse);

The API / Guzlle will return this error to me:

: Uncaught GuzzleHttp\Exception\ClientException: : GET https://api.infojobs.net/api/1/curriculum 401 No Autorizado: { "error": "102", "error_description": " ", "timestamp": "2016-06-25T14: 08: 54.774Z" }   /app/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:107

, - , , .

, .

Oskar

+4
1

HTTP- :

Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==,Bearer 07d18fac-77ea-461f-9bfe-a5e9d98deb3d

Authorization, , . . , Guzzle auth, , .

, :

$newresponse = $basicauth->request(
    'GET',
    'api/1/curriculum',
    ['debug'   => true], 
    ['headers' => 
        [
            'Authorization' => "Basic {$credentials},Bearer {$acceso->access_token}"
        ]
    ]
)->getBody()->getContents();
+6

All Articles