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 Tokens will include other metadata but will not include the serialized token string, and therefore cannot be used to authenticate SDK requests. The serialized token string is only available when you first create a new Access Token. As a security measure, only a hash of the serialized token 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(Search.Filter filter = null, PagingOptions pagingOptions = null);
async Task<AccessTokensPage> FindAsync(Search.Filter filter = null, PagingOptions pagingOptions = null);

Parameters

ParameterTypeDescription
filterSearch.FilterThe filter criteria to search by, or null to fetch all Access Tokens.
pagingOptionsPagingOptionsPaging options including Size and PageToken
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.
 */
using Catalytic.Sdk.Entities;
using System.Collections.Generic;

namespace Catalytic.Sdk.Examples
{
    class Program
    {
        static void Main(string[] args)
        {
            var catalytic = new Catalytic.Sdk.CatalyticClient(AccessToken.Default);
          
            // The default Access Token must belong to a user with admin rights to get
            // or update another user's Access Tokens
            var bobsTokens = catalytic.AccessTokens.Find(
                Where.Owner.Is("[email protected]"));
          
            // Now that we've found all of Bob's Access Tokens, as an admin
            // we can revoke them
            foreach(var token in bobsTokens.AccessTokens)
            {
                catalytic.AccessTokens.Revoke(token.Id);
            }
        }
    }
}