Revoke Access Token

Revoke an Access Token by ID.

šŸ‘

Permissions Required

You can only get metadata for Access Tokens that you created, unless you are a team administrator. Team admins can get metadata for all Access Tokens on your Catalytic team.

Method Signature

revoke(string $id): AccessToken

Parameters

ParameterTypeDescription
$idstringThe id of the Access Token to revoke

Example

<?php

/*
 * This example demonstrates an administrator finding and revoking
 * all the Access Tokens of another user.
 */

require_once(__DIR__ . '/vendor/autoload.php');

use Catalytic\SDK\CatalyticClient;
use Catalytic\SDK\Search\Where;

$catalytic = new CatalyticClient();

// The default Access Token must have admin rights to get another
// user's Access Token

$where = (new Where)->owner()->is('[email protected]');
$results = $catalytic->accessTokens()->find($where);

// Now that we've found all of Bob's Access Tokens, as an admin
// we can revoke them
foreach($results->getAccessTokens() as $bobsAccessToken) {
	$catalytic->accessTokens()->revoke($bobsAccessToken->getId());
}