Tring to revoke token but keept getting bad authorization header

Square SDK version is 44.0.0.20260122.

My PHP version is 8.5.3.

My Composer version is 2.9.5.

Everything is the latest. I have looked and tried all type of PHP code I could find but still got the same error.

[27-Feb-2026 19:53:14 America/Chicago] PHP Fatal error: Uncaught Square\Exceptions\SquareApiException: API request failed
Status code: 400
Body: {
“message”: “bad authorization header”,
“type”: “bad_request.invalid_parameter”
}

This is what I used and I got this from the square website.

$client = new SquareClient(
    token: 'accesstoken',
);
$client->oAuth->revokeToken(
    new RevokeTokenRequest([
        'accessToken' => 'accesstoken',
        'clientId' => 'clientid',
        'Authorization' => 'Client clientsecret',
    ]),
);

When I manually entered the information in the square explorer, it would succeed, but when I tried to run this code on my website, I would get the error above.

The only difference between the square explorer is that it didn't allow us to enter the Authorization and so it did that automatically for us.  But when we tried to do it ourselves, it seems to NOT like it.

I have tried for 2 days and I am NOT getting anywhere.

Please any suggestion and help will be appreciated.