supertokens-node
    Preparing search index...

    Type Alias RecipeInterface

    type RecipeInterface = {
        acceptConsentRequest(
            input: {
                challenge: string;
                context?: any;
                grantAccessTokenAudience?: string[];
                grantScope?: string[];
                handledAt?: string;
                initialAccessTokenPayload: JSONObject | undefined;
                initialIdTokenPayload: JSONObject | undefined;
                rsub: string;
                sessionHandle: string;
                tenantId: string;
                userContext: UserContext;
            },
        ): Promise<ErrorOAuth2 | { redirectTo: string; status: "OK" }>;
        acceptLoginRequest(
            input: {
                acr?: string;
                amr?: string[];
                challenge: string;
                context?: any;
                extendSessionLifespan?: boolean;
                identityProviderSessionId?: string;
                subject: string;
                userContext: UserContext;
            },
        ): Promise<ErrorOAuth2 | { redirectTo: string; status: "OK" }>;
        acceptLogoutRequest(
            input: { challenge: string; userContext: UserContext },
        ): Promise<ErrorOAuth2 | { redirectTo: string }>;
        authorization(
            input: {
                cookies: string | undefined;
                params: Record<string, string>;
                session: SessionContainer | undefined;
                userContext: UserContext;
            },
        ): Promise<
            ErrorOAuth2
            | { cookies: string[] | undefined; redirectTo: string },
        >;
        buildAccessTokenPayload(
            input: {
                client: OAuth2Client;
                scopes: string[];
                sessionHandle: string | undefined;
                user: User | undefined;
                userContext: UserContext;
            },
        ): Promise<JSONObject>;
        buildIdTokenPayload(
            input: {
                client: OAuth2Client;
                scopes: string[];
                sessionHandle: string | undefined;
                user: User | undefined;
                userContext: UserContext;
            },
        ): Promise<JSONObject>;
        buildUserInfo(
            input: {
                accessTokenPayload: JSONObject;
                scopes: string[];
                tenantId: string;
                user: User;
                userContext: UserContext;
            },
        ): Promise<JSONObject>;
        createOAuth2Client(
            input: Partial<Omit<OAuth2ClientOptions, "createdAt" | "updatedAt">> & {
                userContext: UserContext;
            },
        ): Promise<
            | { client: OAuth2Client; status: "OK" }
            | { error: string; errorDescription: string; status: "ERROR" },
        >;
        deleteOAuth2Client(
            input: DeleteOAuth2ClientInput & { userContext: UserContext },
        ): Promise<
            | { status: "OK" }
            | { error: string; errorDescription: string; status: "ERROR" },
        >;
        endSession(
            input: {
                params: Record<string, string>;
                session?: SessionContainer;
                shouldTryRefresh: boolean;
                userContext: UserContext;
            },
        ): Promise<ErrorOAuth2 | { redirectTo: string }>;
        getConsentRequest(
            input: { challenge: string; userContext: UserContext },
        ): Promise<ErrorOAuth2 | ConsentRequest>;
        getFrontendRedirectionURL(
            input:
                | {
                    forceFreshAuth: boolean;
                    hint: string
                    | undefined;
                    loginChallenge: string;
                    tenantId: string;
                    type: "login";
                    userContext: UserContext;
                }
                | {
                    loginChallenge: string;
                    type: "try-refresh";
                    userContext: UserContext;
                }
                | {
                    logoutChallenge: string;
                    type: "logout-confirmation";
                    userContext: UserContext;
                }
                | { type: "post-logout-fallback"; userContext: UserContext },
        ): Promise<string>;
        getLoginRequest(
            input: { challenge: string; userContext: UserContext },
        ): Promise<ErrorOAuth2 | LoginRequest & { status: "OK" }>;
        getOAuth2Client(
            input: { clientId: string; userContext: UserContext },
        ): Promise<
            | { client: OAuth2Client; status: "OK" }
            | { error: string; errorDescription: string; status: "ERROR" },
        >;
        getOAuth2Clients(
            input: GetOAuth2ClientsInput & { userContext: UserContext },
        ): Promise<
            | {
                clients: OAuth2Client[];
                nextPaginationToken?: string;
                status: "OK";
            }
            | { error: string; errorDescription: string; status: "ERROR" },
        >;
        getRequestedScopes(
            input: {
                clientId: string;
                recipeUserId: RecipeUserId | undefined;
                scopeParam: string[];
                sessionHandle: string | undefined;
                userContext: UserContext;
            },
        ): Promise<string[]>;
        introspectToken(
            input: { scopes?: string[]; token: string; userContext: UserContext },
        ): Promise<ErrorOAuth2 | (InstrospectTokenResponse & { status: "OK"; })>;
        rejectConsentRequest(
            input: {
                challenge: string;
                error: ErrorOAuth2;
                userContext: UserContext;
            },
        ): Promise<ErrorOAuth2 | { redirectTo: string; status: "OK" }>;
        rejectLoginRequest(
            input: {
                challenge: string;
                error: ErrorOAuth2;
                userContext: UserContext;
            },
        ): Promise<ErrorOAuth2 | { redirectTo: string; status: "OK" }>;
        rejectLogoutRequest(
            input: { challenge: string; userContext: UserContext },
        ): Promise<{ status: "OK" }>;
        revokeToken(
            input: { token: string; userContext: UserContext } & (
                | { authorizationHeader: string }
                | { clientId: string; clientSecret?: string }
            ),
        ): Promise<ErrorOAuth2 | { status: "OK" }>;
        revokeTokensByClientId(
            input: { clientId: string; userContext: UserContext },
        ): Promise<{ status: "OK" }>;
        revokeTokensBySessionHandle(
            input: { sessionHandle: string; userContext: UserContext },
        ): Promise<{ status: "OK" }>;
        tokenExchange(
            input: {
                authorizationHeader?: string;
                body: Record<string, string | undefined>;
                userContext: UserContext;
            },
        ): Promise<ErrorOAuth2 | TokenInfo>;
        updateOAuth2Client(
            input: NonNullableProperties<
                Omit<
                    Partial<Omit<OAuth2ClientOptions, "createdAt" | "updatedAt">>,
                    "metadata" | "redirectUris" | "grantTypes" | "responseTypes",
                >,
            > & {
                clientId: string;
                grantTypes?: string[] | null;
                metadata?: Record<string, any> | null;
                redirectUris?: string[] | null;
                responseTypes?: string[] | null;
            } & { userContext: UserContext },
        ): Promise<
            | { client: OAuth2Client; status: "OK" }
            | { error: string; errorDescription: string; status: "ERROR" },
        >;
        validateOAuth2AccessToken(
            input: {
                checkDatabase?: boolean;
                requirements?: {
                    audience?: string;
                    clientId?: string;
                    scopes?: string[];
                };
                token: string;
                userContext: UserContext;
            },
        ): Promise<{ payload: JSONObject; status: "OK" }>;
    }
    Index

    Methods

    • Parameters

      • input: {
            challenge: string;
            context?: any;
            grantAccessTokenAudience?: string[];
            grantScope?: string[];
            handledAt?: string;
            initialAccessTokenPayload: JSONObject | undefined;
            initialIdTokenPayload: JSONObject | undefined;
            rsub: string;
            sessionHandle: string;
            tenantId: string;
            userContext: UserContext;
        }

      Returns Promise<ErrorOAuth2 | { redirectTo: string; status: "OK" }>

    • Parameters

      • input: {
            acr?: string;
            amr?: string[];
            challenge: string;
            context?: any;
            extendSessionLifespan?: boolean;
            identityProviderSessionId?: string;
            subject: string;
            userContext: UserContext;
        }

      Returns Promise<ErrorOAuth2 | { redirectTo: string; status: "OK" }>

    • Parameters

      • input: { challenge: string; userContext: UserContext }

      Returns Promise<ErrorOAuth2 | { redirectTo: string }>

    • Parameters

      • input: {
            cookies: string | undefined;
            params: Record<string, string>;
            session: SessionContainer | undefined;
            userContext: UserContext;
        }

      Returns Promise<ErrorOAuth2 | { cookies: string[] | undefined; redirectTo: string }>

    • Parameters

      • input: {
            client: OAuth2Client;
            scopes: string[];
            sessionHandle: string | undefined;
            user: User | undefined;
            userContext: UserContext;
        }

      Returns Promise<JSONObject>

    • Parameters

      • input: {
            client: OAuth2Client;
            scopes: string[];
            sessionHandle: string | undefined;
            user: User | undefined;
            userContext: UserContext;
        }

      Returns Promise<JSONObject>

    • Parameters

      • input: {
            accessTokenPayload: JSONObject;
            scopes: string[];
            tenantId: string;
            user: User;
            userContext: UserContext;
        }

      Returns Promise<JSONObject>

    • Parameters

      • input: Partial<Omit<OAuth2ClientOptions, "createdAt" | "updatedAt">> & {
            userContext: UserContext;
        }

      Returns Promise<
          | { client: OAuth2Client; status: "OK" }
          | { error: string; errorDescription: string; status: "ERROR" },
      >

    • Parameters

      • input: DeleteOAuth2ClientInput & { userContext: UserContext }

      Returns Promise<
          | { status: "OK" }
          | { error: string; errorDescription: string; status: "ERROR" },
      >

    • Parameters

      • input: {
            params: Record<string, string>;
            session?: SessionContainer;
            shouldTryRefresh: boolean;
            userContext: UserContext;
        }

      Returns Promise<ErrorOAuth2 | { redirectTo: string }>

    • Parameters

      • input: { challenge: string; userContext: UserContext }

      Returns Promise<ErrorOAuth2 | ConsentRequest>

    • Parameters

      • input:
            | {
                forceFreshAuth: boolean;
                hint: string
                | undefined;
                loginChallenge: string;
                tenantId: string;
                type: "login";
                userContext: UserContext;
            }
            | { loginChallenge: string; type: "try-refresh"; userContext: UserContext }
            | {
                logoutChallenge: string;
                type: "logout-confirmation";
                userContext: UserContext;
            }
            | { type: "post-logout-fallback"; userContext: UserContext }

      Returns Promise<string>

    • Parameters

      • input: { challenge: string; userContext: UserContext }

      Returns Promise<ErrorOAuth2 | LoginRequest & { status: "OK" }>

    • Parameters

      • input: { clientId: string; userContext: UserContext }

      Returns Promise<
          | { client: OAuth2Client; status: "OK" }
          | { error: string; errorDescription: string; status: "ERROR" },
      >

    • Parameters

      • input: GetOAuth2ClientsInput & { userContext: UserContext }

      Returns Promise<
          | {
              clients: OAuth2Client[];
              nextPaginationToken?: string;
              status: "OK";
          }
          | { error: string; errorDescription: string; status: "ERROR" },
      >

    • Parameters

      • input: {
            clientId: string;
            recipeUserId: RecipeUserId | undefined;
            scopeParam: string[];
            sessionHandle: string | undefined;
            userContext: UserContext;
        }

      Returns Promise<string[]>

    • Parameters

      • input: { scopes?: string[]; token: string; userContext: UserContext }

      Returns Promise<ErrorOAuth2 | (InstrospectTokenResponse & { status: "OK"; })>

    • Parameters

      • input: { challenge: string; error: ErrorOAuth2; userContext: UserContext }

      Returns Promise<ErrorOAuth2 | { redirectTo: string; status: "OK" }>

    • Parameters

      • input: { challenge: string; error: ErrorOAuth2; userContext: UserContext }

      Returns Promise<ErrorOAuth2 | { redirectTo: string; status: "OK" }>

    • Parameters

      • input: { challenge: string; userContext: UserContext }

      Returns Promise<{ status: "OK" }>

    • Parameters

      • input: { token: string; userContext: UserContext } & (
            | { authorizationHeader: string }
            | { clientId: string; clientSecret?: string }
        )

      Returns Promise<ErrorOAuth2 | { status: "OK" }>

    • Parameters

      • input: { clientId: string; userContext: UserContext }

      Returns Promise<{ status: "OK" }>

    • Parameters

      • input: { sessionHandle: string; userContext: UserContext }

      Returns Promise<{ status: "OK" }>

    • Parameters

      • input: {
            authorizationHeader?: string;
            body: Record<string, string | undefined>;
            userContext: UserContext;
        }

      Returns Promise<ErrorOAuth2 | TokenInfo>

    • Parameters

      • input: NonNullableProperties<
            Omit<
                Partial<Omit<OAuth2ClientOptions, "createdAt" | "updatedAt">>,
                "metadata" | "redirectUris" | "grantTypes" | "responseTypes",
            >,
        > & {
            clientId: string;
            grantTypes?: string[] | null;
            metadata?: Record<string, any> | null;
            redirectUris?: string[] | null;
            responseTypes?: string[] | null;
        } & { userContext: UserContext }

      Returns Promise<
          | { client: OAuth2Client; status: "OK" }
          | { error: string; errorDescription: string; status: "ERROR" },
      >

    • Parameters

      • input: {
            checkDatabase?: boolean;
            requirements?: { audience?: string; clientId?: string; scopes?: string[] };
            token: string;
            userContext: UserContext;
        }

      Returns Promise<{ payload: JSONObject; status: "OK" }>