Hi I'm trying to get a token from an api but no matter what I try on the droplet I get an invalid client every single time, the code is the same locally and on the droplet, currently working on local but not on the droplet.
This is the code
return Cache::rememberForever('payment_token', function () {
$client = new Client(['http_errors' => false]);
$params = [
'client_id' => env('CLIENT_ID'),
'client_secret' => env('CLIENT_SECRET'),
'grant_type' => 'client_credentials',
];
$headers = [
'Accept' => 'application/json',
];
$response = $client->request('POST', 'https://apipay.io/auth/token/', [
'json' => $params,
'headers' => $headers
]);
$res_body = json_decode($response->getBody()->getContents());
return $res_body->access_token;
});
The url for the post isn't a real one, I don't really think it's wise to post the real one as it doesn't work without the client_id and client_secret which I can't post here.
Is there a reason why the droplet would interfere with this? What can I do to fix this?