mardi 17 janvier 2017

Guzzle PUT request auth error

I have the following code to save content using API from another system. I have added the credentials but it showing wrong credentials error. It is working perfectly in postman.

    $client = new GuzzleHttpClient();
try {
  $request = new \GuzzleHttp\Psr7\Request('PUT', config('cms.api.backend') .'/products/'. $nid,
    [
      'auth' => [config('cms.api.user'), config('cms.api.password')],
      'form_params' => [
        'copywrite' => Input::get('copywrite'),
        'status' => $status
      ],
  ]);
  $promise = $client->sendAsync($request)->then(function ($response) {});
  $promise->wait();
}
catch (RequestException $e) {
  $this->logHttpError($e->getResponse()->getStatusCode(), $e->getResponse()->getBody(true));
}

What could be wrong in the above code?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2jjYg3V
via IFTTT

Aucun commentaire:

Enregistrer un commentaire