Class InMemoryTokenStorageAdapter

An in-memory adapter for storing, listing and retrieving service app authorization tokens.

Hierarchy

  • InMemoryTokenStorageAdapter

Implements

Constructors

  • Parameters

    • tokenCache: {
          [orgId: string]: OrgServiceAppAuthorization;
      } = {}
      • [orgId: string]: OrgServiceAppAuthorization

    Returns InMemoryTokenStorageAdapter

Methods

  • Method to set the token for an organization.

    Example

    await storageAdapter.setToken('org-id', token);
    

    Parameters

    • orgId: string

      Organization ID

    • token: OrgServiceAppAuthorization

      Respective token

    Returns Promise<void>

  • Method to extract a token based on the organization id.

    Returns

    The token object for the organization

    Example

    const token = await storageAdapter.getToken('org-id');
    

    Parameters

    • orgId: string

      Organization ID

    Returns Promise<OrgServiceAppAuthorization>

  • Method which returns the list of all tokens stored in the InMemoryTokenStorageAdapter.

    Returns

    List of

    Example

    const tokens = await storageAdapter.listTokens();
    

    Returns Promise<OrgServiceAppAuthorization[]>

  • Method to delete a token based on the organization id.

    Returns

    Example

    await storageAdapter.deleteToken('org-id');
    

    Parameters

    • orgId: string

      Organization ID

    Returns Promise<void>

  • Method to remove all tokens stored in the InMemoryTokenStorageAdapter.

    Returns

    Example

    await storageAdapter.resetTokens();
    

    Returns Promise<void>