Find Access Tokens

Search for Access Tokens matching a given name or owner, or page through all of your Access Tokens. Note that the returned Access Token will include other metadata but will not include the secret, and therefore cannot be used to authenticate SDK requests. The secret is only available when you first create a new Access Token because Catalytic does not store the Access Token secret. As a security measure, only a hash of the secret is stored.

πŸ‘

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

AccessTokensPage find();
AccessTokensPage find(Filter filter);
AccessTokensPage find(String pageToken);
AccessTokensPage find(Filter filter, String pageToken);
AccessTokensPage find(Filter filter, String pageToken, Integer pageSize);

Parameters

ParameterTypeDescription
filterFilterThe filter criteria to search by, or null to fetch all Access Tokens.
pageTokenStringThe token of the page to fetch.
pageSizeIntegerThe number of results per page to fetch.
returnsAccessTokensPageThe requested page of Access Tokens

You can search for matches among the following attributes of the Where class.

NameTypeDescription
textStringSearch for Access Tokens by name.
ownerStringSearch for Access Tokens owned by a specific team member. The email address of the owner of the Instance must match exactly, apart from casing.

Example

/*
 * This example demonstrates an administrator finding and revoking
 * all the Access Tokens of another user.
 */
import org.catalytic.sdk.CatalyticClient;
import org.catalytic.sdk.entities.AccessTokens;
import org.catalytic.sdk.entities.AccessTokensPage;
import org.catalytic.sdk.search.Where;

public class Program {
  
    public static void main(String[] args) throws Exception {
                
        CatalyticClient catalytic = new CatalyticClient();
        List<AccessToken> accessTokens = new ArrayList<>();
      
        // Find all Access Tokens where the owner is [email protected]
        Where where = new Where().owner().is("[email protected]");
        AccessTokensPage results = catalytic.accessTokens().find(where);
      
        // Add the results from the first page to the Access Tokens array
        accessTokens.addAll(results.getAccessTokens());
      
        // Loop through all the pages to get all the Access Tokens
        while(results.getNextPageToken() != null) {
            results = catalytic.accessTokens().find(where, results.getNextPageToken());
            accessTokens.addAll(results.getAccessTokens());
        }
    }
}