I built at the beggining of this year a web application only for my personal purpouse to retrieve the values of recent sells from specific items and now I ran the project again and the authentication is not working anymore even if I didn't change the code and it's the first time I face this problem.
The code Im running is the following one:
public function obtenerAccessToken()
{
$clientId = config('services.ebay.client_id');
$clientSecret = config('services.ebay.client_secret');
$credentials = base64_encode($clientId . ':' . $clientSecret);
try {
Log::info('Retrieving eBay token');
'headers' => [
'Content-Type' => 'application/x-www-form-urlencoded',
'Authorization' => 'Basic ' . $credentials,
],
'form_params' => [
'grant_type' => 'client_credentials',
],
]);
$data = json_decode($response->getBody(), true);
if (isset($data['access_token'])) {
Log::info('Access token obtained succesfully: '. $data['access_token']);
return $data['access_token'];
} else {
Log::error('Error obtaining token: ' . print_r($data, true));
return null;
}
} catch (\Exception $e) {
Log::error('Exception: ' . $e->getMessage());
return null;
}
}
and Im getting the following error everytime Client error: `POST https://api.ebay.com/identity/v1/oauth2/token` resulted in a `401 Unauthorized` response:
{"error":"invalid_client","error_description":"client authentication failed"}
I already double checked that the variables for the ClientID and Secrets are right and also refreshed the client Secret without any success. I don't know if during this period something changed to create the token...