Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/oauth2_server/authorization_server.ts>AbstractAccessTokenService

A standards compliant implementation of an OAuth 2.0 authorization server with PKCE support.
Latest
class AbstractAccessTokenService
Abstract
import { AbstractAccessTokenService } from "https://deno.land/x/oauth2_server@0.12.0/authorization_server.ts";

Type Parameters

Client extends ClientInterface
User
Scope extends ScopeInterface

Properties

accessTokenLifetime

Lifetime of access tokens in seconds. Defaults to 1 hour.

refreshTokenLifetime: number

Lifetime of refresh tokens in seconds. Defaults to 0.

Methods

acceptedScope(
_client: Client,
_user: User,
scope?: Scope | null,
): Promise<
| null
| undefined
| false
>

Returns the accepted scope for the client and user.

accessTokenExpiresAt(
client: Client,
_user: User,
_scope?: Scope | null,
): Promise<Date | undefined>

Gets the date that a new access token would expire at.

generateAccessToken(
_client: Client,
_user: User,
_scope?: Scope | null,
): Promise<string>

Generates an access token. Defaults to an RFC4122 v4 UUID (pseudo-randomly-based).

generateRefreshToken(
_client: Client,
_user: User,
_scope?: Scope | null,
): Promise<string | undefined>

Generates a refresh token. Not implemented by default.

getRefreshToken(_refreshToken: string): Promise<RefreshToken<Client, User, Scope> | undefined>

Retrieves an existing refresh token. Not implemented by default.

abstract
getToken(accessToken: string): Promise<AccessToken<Client, User, Scope> | undefined>

Retrieves an existing access token.

refreshTokenExpiresAt(
_client: Client,
_user: User,
_scope?: Scope | null,
): Promise<Date | undefined>

Gets the date that a new refresh token would expire at. Not implemented by default.

abstract
revoke(token: AccessToken<Client, User, Scope>): Promise<boolean>

Revokes a token. Resolves true if a token was revoked or invalid.

abstract
revoke(token: string, hint?: string | null): Promise<boolean>
abstract
revokeCode(code: string): Promise<boolean>

Revokes all tokens for an authorization code. Resolves true if a authorization code was revoked or invalid.

abstract
save(token: AccessToken<Client, User, Scope>): Promise<AccessToken<Client, User, Scope>>

Saves a token.