Interface AuthProvider

Authentication provider that manages user access tokens.

This interface can be implemented in various ways. Two built-in implementations are provided:

If these implementations are not sufficient for your use case, you can create a custom one. For example, you could store and manage authentication data in Redis to share it between multiple processes or containers.

interface AuthProvider {
    clientId: string;
    getAccessTokenForUser(
        user: UserIdResolvable,
        scopes?: string[],
    ): Promise<AccessTokenWithUserId>;
    getScopesForUser(user: UserIdResolvable): string[];
    refreshAccessTokenForUser(
        user: UserIdResolvable,
    ): Promise<AccessTokenWithUserId>;
}

Implemented by

Properties

clientId: string

The client ID.

Methods