supertokens-web-js
Version:
SuperTokens SDK for vanilla JS for all recipes
59 lines (58 loc) • 2.37 kB
TypeScript
import {
NormalisedInputType as AuthRecipeNormalisedInputType,
InputType as AuthRecipeInputType,
} from "../authRecipe/types";
import {
RecipeFunctionOptions,
RecipePostAPIHookContext,
RecipePreAPIHookContext,
UserInput as RecipeModuleUserInput,
} from "../recipeModule/types";
import OverrideableBuilder from "supertokens-js-override";
export declare type PreAndPostAPIHookAction = "GET_LOGIN_METHODS";
export declare type PreAPIHookContext = RecipePreAPIHookContext<PreAndPostAPIHookAction>;
export declare type PostAPIHookContext = RecipePostAPIHookContext<PreAndPostAPIHookAction>;
export declare type UserInput = {
override?: {
functions?: (
originalImplementation: RecipeInterface,
builder: OverrideableBuilder<RecipeInterface>
) => RecipeInterface;
};
} & RecipeModuleUserInput<PreAndPostAPIHookAction>;
export declare type InputType = AuthRecipeInputType<PreAndPostAPIHookAction> & UserInput;
export declare type NormalisedInputType = AuthRecipeNormalisedInputType<PreAndPostAPIHookAction> & {
override: {
functions: (
originalImplementation: RecipeInterface,
builder: OverrideableBuilder<RecipeInterface>
) => RecipeInterface;
};
};
export declare type RecipeInterface = {
getTenantId: (input: { userContext: any }) => Promise<string | undefined> | string | undefined;
/**
* Gets enabled login methods and their configuration
*
* @param tenantId (OPTIONAL) The identifier for the tenant.
*
* @param userContext (OPTIONAL) Refer to {@link https://supertokens.com/docs/emailpassword/advanced-customizations/user-context the documentation}
*
* @param options (OPTIONAL) Use this to configure additional properties (for example pre api hooks)
*
* @throws STGeneralError if the API exposed by the backend SDKs returns `status: "GENERAL_ERROR"`
*
* @returns `{status: OK, emailpassword, passwordless, thirdParty}` if successful
*/
getLoginMethods: (input: { tenantId?: string; options?: RecipeFunctionOptions; userContext: any }) => Promise<{
status: "OK";
thirdParty: {
providers: {
id: string;
name: string;
}[];
};
firstFactors: string[];
fetchResponse: Response;
}>;
};