Open bboriondev opened 2 hours ago
Please, check the provided data again - especially encoded data (ClientID and Client Secret with ":" between them). Our example should work without any issues. Also, check our tutorial once more.
I'm using the method copied from the tutorial, which encodes the two constants - I tried it with another cliend it / secret key pair, same result.
Please, send us the sample data which you provided - you can do it via the Allegro contact form (add GitHub thread number).
Hello, I want to use the API, with the generated Client Id / Secret, but it returns 401 Unauthorized. I'm using the php example from the docs:
function getAccessToken() { $authorization = base64_encode(CLIENT_ID.':'.CLIENT_SECRET); $headers = array("Authorization: Basic {$authorization}","Content-Type: application/x-www-form-urlencoded"); $content = "grant_type=client_credentials"; $ch = getCurl($headers, $content); $tokenResult = curl_exec($ch); $resultCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($tokenResult === false || $resultCode !== 200) { exit ("Something went wrong $resultCode $tokenResult"); } return json_decode($tokenResult)->access_token; }
The client ID is 4fcbfdd799774097a78cd3408f3f449a4fcbfdd799774097a78cd3408f3f449a How can I find out why the request fails? Thank you in advance!