Revoke Access Token

Revoke Access Token by ID.

πŸ‘

Permissions Required

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

Method Signature

AccessToken revoke(String id);

Parameters

ParameterTypeDescription
idStringThe id of the Access Token to revoke
returnsAccessTokenThe revoked Access Token

Example

/*
 * This example demonstrates getting Access Token by ID
 */

import org.catalytic.sdk.CatalyticClient;
import org.catalytic.sdk.entities.AccessTokensPage;
import org.catalytic.sdk.search.Where;

public class Program {
  
    public static void main(String[] args) throws Exception {
                
        // Create and initialize the Catalytic SDK Client
        CatalyticClient catalytic = new CatalyticClient();
      
        // The default accessToken must have admin rights to get another
        // user's Access Tokens

        Where where = new Where().owner().is('[email protected]');
        AccessTokensPage results = catalytic.accessTokens().find(where);

        // Now that we've found all of Bob's Access Tokens, as an admin
        // we can revoke them
        for(AccessToken bobsAccessToken : results.getAccessTokens()) {
            catalytic.accessTokens().revoke(bobsAccessToken.getId());
        }
    }
}