interface PluginOptions {
    ajv?: any;
    authorizationCodeExpiration?: string;
    components?: {
        "consent-form"?: string;
        "scope-list"?: string;
        "the-footer"?: string;
        "the-header"?: string;
    };
    includeErrorDescription?: boolean;
    issuer?: string;
    logPrefix?: string;
    onAuthorizationCodeVerified: (...param: [string]) => Promise<void>;
    onUserApprovedRequest: (
        ...param: [
            {
                client_id: string;
                code: string;
                code_challenge: unknown;
                code_challenge_method: unknown;
                exp: number;
                iss?: string;
                me: string;
                redirect_uri: string;
                scope: string;
                used?: boolean;
            },
        ],
    ) => Promise<void>;
    redirectPathOnSubmit?: string;
    reportAllAjvErrors?: boolean;
    retrieveAuthorizationCode: (
        ...param: [string],
    ) => Promise<
        | {
            client_id: string;
            code: string;
            code_challenge: unknown;
            code_challenge_method: unknown;
            created_at: number;
            exp: number;
            id: string
            | number;
            iss?: string;
            me: string;
            redirect_uri: string;
            scope: string;
            used?: boolean;
        }
        | {
            client_id: string;
            code: string;
            code_challenge: unknown;
            code_challenge_method: unknown;
            created_at: null
            | number;
            deleted_at?: null | number;
            exp: number;
            id: string | number;
            iss?: string;
            me: string;
            redirect_uri: string;
            scope: string;
            undeleted_at?: null | number;
            updated_at?: null | number;
            used?: boolean;
        },
    >;
    templates?: string[];
}

Hierarchy

Properties

ajv?: any = ...

AJV instance, for validation.

authorizationCodeExpiration?: string = ...

Human-readable expiration time for the authorization code. It will be shown in the consent screen.

'60 seconds'
components?: {
    "consent-form"?: string;
    "scope-list"?: string;
    "the-footer"?: string;
    "the-header"?: string;
} = ...
includeErrorDescription?: boolean = ...

Whether to include an error_description property in all error responses.

issuer?: string = ...

Issuer identifier. This is optional in OAuth 2.0 servers, but required in IndieAuth servers.

See also the authorization_response_iss_parameter_supported parameter in IndieAuth Server Metadata.

logPrefix?: string = ...
onAuthorizationCodeVerified: (...param: [string]) => Promise<void>

Handler that runs after the authorization code has been verified. You should use this handler to inform your storage backend that the authorization code has been used.

onUserApprovedRequest: (
    ...param: [
        {
            client_id: string;
            code: string;
            code_challenge: unknown;
            code_challenge_method: unknown;
            exp: number;
            iss?: string;
            me: string;
            redirect_uri: string;
            scope: string;
            used?: boolean;
        },
    ],
) => Promise<void>

Handler executed after the user approves the authorization request on the consent screen. It should be used to persist the authorization code generated by the authorization endpoint into your storage backend.

redirectPathOnSubmit?: string = ...
reportAllAjvErrors?: boolean = ...

Whether to include all AJV errors when validation fails.

retrieveAuthorizationCode: (
    ...param: [string],
) => Promise<
    | {
        client_id: string;
        code: string;
        code_challenge: unknown;
        code_challenge_method: unknown;
        created_at: number;
        exp: number;
        id: string
        | number;
        iss?: string;
        me: string;
        redirect_uri: string;
        scope: string;
        used?: boolean;
    }
    | {
        client_id: string;
        code: string;
        code_challenge: unknown;
        code_challenge_method: unknown;
        created_at: null
        | number;
        deleted_at?: null | number;
        exp: number;
        id: string | number;
        iss?: string;
        me: string;
        redirect_uri: string;
        scope: string;
        undeleted_at?: null | number;
        updated_at?: null | number;
        used?: boolean;
    },
>

Function that retrieves an authorization code from some storage.

templates?: string[] = ...