Próbuję szczęścia z API REST, ale coś mi nie wychodzi

Czy możecie rzucić okiem na mój kod, którym chciałbym pobrać moje oferty?
<?php
function getAccessToken(): String
{
$authUrl = "https://allegro.pl/auth/oauth/token?grant_type=client_credentials";
$clientId = "...";
$clientSecret = "...";
$ch = curl_init($authUrl);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERNAME, $clientId);
curl_setopt($ch, CURLOPT_PASSWORD, $clientSecret);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$tokenResult = curl_exec($ch);
$resultCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($tokenResult === false || $resultCode !== 200) {
exit ("Something went wrong!"); }
$tokenObject = json_decode($tokenResult);
return $tokenObject->access_token;
}
function getOffers(String $token): stdClass
{
$url = "https://api.allegro.pl/sale/offers";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer $token",
"Accept: application/vnd.allegro.public.v1+json"
]);
$result = curl_exec($ch);
$resultCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($result === false || $resultCode !== 200) {
exit ("Something went wrong"); }
$offers = json_decode($result);
return $offers;
}
function main_4()
{
$token = getAccessToken();
}
main_4();
?>