Skip to main content
Version: Next

Overriding APIs

Main interface#

    /*
* Called to return all JWKs that can be used for JWT verification
*
* @method GET
*
* @params: set it to undefined to disable the API.
* - options: See APIOptions below
*
* @returns "OK" and array of keys (refer to JsonWebKey below for typedef)
*/
getJWKSGET:
| undefined
| ((input: {
options: APIOptions
}) => Promise<{
status: "OK";
keys: JsonWebKey[];
}>)

Supporting Types#

interface BaseRequest {
original: Express.Request;
getKeyValueFromQuery: (key: string) => Promise<string | undefined>;
getJSONBody: () => Promise<any>;
getMethod: () => HTTPMethod;
getCookieValue: (key_: string) => string | undefined;
getHeaderValue: (key: string) => string | undefined;
getOriginalURL: () => string;
}

interface BaseResponse {
original: Express.Response;
setHeader: (key: string, value: string, allowDuplicateKey: boolean) => void;
setCookie: (
key: string,
value: string,
domain: string | undefined,
secure: boolean,
httpOnly: boolean,
expires: number,
path: string,
sameSite: "strict" | "lax" | "none"
) => void;
setStatusCode: (statusCode: number) => void;
sendJSONResponse: (content: any) => void;
}
type APIOptions = {
recipeImplementation: RecipeInterface;
config: TypeNormalisedInput;
recipeId: string;
isInServerlessEnv: boolean;
req: BaseRequest;
res: BaseResponse;
};

type JsonWebKey = {
kty: string;
kid: string;
n: string;
e: string;
alg: string;
use: string;
};
Which frontend SDK do you use?
supertokens-web-js / mobile
supertokens-auth-react