-
Couldn't load subscription status.
- Fork 182
Description
Hi,
I'm using the code below to revoke access tokens, but I always get a Dropbox\Exceptions\DropboxClientException with message 'Invalid Response' (thus the if-statement in the catch).
try {
$app = new Dropbox\DropboxApp($dropbox_app_id,$dropbox_app_sec,$user_access_token);
$dropbox = new Dropbox\Dropbox($app);
$authHelper = $dropbox->getAuthHelper();
$authHelper->revokeAccessToken();
} catch (Dropbox\Exceptions\DropboxClientException $e) {
if ($e->getMessage() == 'Invalid Response') {
echo 'Token revoked';
}
}
The revoke works fine, I was just wondering whether there is a way to revoke the token without getting the exception. Here is what I found:
The exception gets thrown as the response is validated. According to the official documentation revoking a token does not return anything. Since the validate function is built to throw the exception if the decodedBody of the response is null, the exception will always get thrown when revoking a token.
So, we'd need to pass something like a $isRevokeRequest parameter to the validateResponse function in order to not get the exception.
Cheers,
-Taduuda