Skip to content
Esc
navigateopen⌘Jpreview
Dashboard
On this page

supertokens-web-js/types

References documentation for the supertokens-web-js/types package

Type Aliases

AllRecipeConfigs

type AllRecipeConfigs = object;

Defined in: tmp/supertokens-web-js/lib/ts/types.ts

Properties


AppInfoUserInput

type AppInfoUserInput = object;

Defined in: tmp/supertokens-web-js/lib/ts/types.ts

Properties

Property Type Description Defined in
apiBasePath? string The path at which the SuperTokens APIs are exposed by your backend. Defaults to /auth. This value must match the one set in the backend SDKs for SuperTokens to work correctly tmp/supertokens-web-js/lib/ts/types.ts
apiDomain string The domain at which you host your backend SDKs. This is used by the SDK when making network requests. For example if your API server is running on http://localhost:8080 then when calling SuperTokens.init the value for apiDomain should be set to http://localhost:8080 This value must match the one set in the backend SDKs for SuperTokens to work correctly tmp/supertokens-web-js/lib/ts/types.ts
apiGatewayPath? string An API gateway may be used which prepends a path to the API route. That path should be specified here. tmp/supertokens-web-js/lib/ts/types.ts
appName string The name of your application tmp/supertokens-web-js/lib/ts/types.ts

CreateRecipeFunction()<Action>

type CreateRecipeFunction<Action> = (appInfo, clientType, enableDebugLogs, overrideMaps) => RecipeModule<Action, NormalisedRecipeConfig<Action>>;

Defined in: tmp/supertokens-web-js/lib/ts/types.ts

Type Parameters

Type Parameter
Action

Parameters

Parameter Type
appInfo NormalisedAppInfo
clientType string | undefined
enableDebugLogs boolean
overrideMaps NonNullable<SuperTokensPlugin["overrideMap"]>[]

Returns

RecipeModule<Action, NormalisedRecipeConfig<Action>>


GeneralErrorResponse

type GeneralErrorResponse = object;

Defined in: tmp/supertokens-web-js/lib/ts/types.ts

Properties

Property Type Defined in
fetchResponse Response tmp/supertokens-web-js/lib/ts/types.ts
message string tmp/supertokens-web-js/lib/ts/types.ts
status "GENERAL_ERROR" tmp/supertokens-web-js/lib/ts/types.ts

NonPublicConfigPropertiesType

type NonPublicConfigPropertiesType = typeof nonPublicConfigProperties[number];

Defined in: tmp/supertokens-web-js/lib/ts/types.ts


NormalisedAppInfo

type NormalisedAppInfo = object;

Defined in: tmp/supertokens-web-js/lib/ts/types.ts

Normalised version of the config passed to SuperTokens.init

Properties

Property Type Description Defined in
apiBasePath NormalisedURLPath The path at which the SuperTokens APIs are exposed by your backend. Defaults to /auth. This value must match the one set in the backend SDKs for SuperTokens to work correctly tmp/supertokens-web-js/lib/ts/types.ts
apiDomain NormalisedURLDomain The domain at which you host your backend SDKs. This is used by the SDK when making network requests. For example if your API server is running on http://localhost:8080 then when calling SuperTokens.init the value for apiDomain should be set to http://localhost:8080 This value must match the one set in the backend SDKs for SuperTokens to work correctly tmp/supertokens-web-js/lib/ts/types.ts
appName string The name of your application tmp/supertokens-web-js/lib/ts/types.ts

RecipePluginOverride<T>

type RecipePluginOverride<T> = object;

Defined in: tmp/supertokens-web-js/lib/ts/types.ts

Type Parameters

Type Parameter
T extends keyof AllRecipeConfigs

Properties

Property Type Defined in
config? (config) => AllRecipeConfigs[T] tmp/supertokens-web-js/lib/ts/types.ts
functions? NonNullable<AllRecipeConfigs[T]["override"]>["functions"] tmp/supertokens-web-js/lib/ts/types.ts

SuperTokensConfig

type SuperTokensConfig = object;

Defined in: tmp/supertokens-web-js/lib/ts/types.ts

The configuration object to be passed when calling SuperTokens.init

Properties

Property Type Description Defined in
appInfo AppInfoUserInput The information specific to your application, this helps the SDK understand how SuperTokens is setup in your system tmp/supertokens-web-js/lib/ts/types.ts
clientType? string Identifier for the client, such as web, ios, etc. to be used with thirdparty, multitenancy recipes. tmp/supertokens-web-js/lib/ts/types.ts
cookieHandler? CookieHandlerInput Custom handlers that the SDK should use when trying to read or write to document.cookie In most cases you should not need to provide these. When provided, the SDK will rely on these functions instead of using document.cookie directly When using this feature, take extra care to use the correct function version (async/async). The interface by default uses async versions of the functions when possible but specific parts of the SDK may rely on using the sync versions instead. tmp/supertokens-web-js/lib/ts/types.ts
dateProvider? DateProviderInput Custom provider for SDK timing calculations relative to server time. The default implementation automatically adjusts for client-server time deviation. Typically, you won’t need to provide these. If provided, the SDK uses your implementation instead of the default one. tmp/supertokens-web-js/lib/ts/types.ts
enableDebugLogs? boolean Enabled logging for the SuperTokens SDK. The SDK will log information in different stages. tmp/supertokens-web-js/lib/ts/types.ts
experimental? object Our experimental features are not yet stable and are subject to change. In practical terms, this means that their interface is subject to change without a major version update. They are also not tested as much as our “normal” features. If you want to use these features, or if you have any feedback please let us know at: https://supertokens.com/discord tmp/supertokens-web-js/lib/ts/types.ts
experimental.plugins? SuperTokensPlugin[] - tmp/supertokens-web-js/lib/ts/types.ts
recipeList CreateRecipeFunction<any>[] List of recipes that you want to use. Refer to the documentation for the recipe that you want to use to know how this property should be set. tmp/supertokens-web-js/lib/ts/types.ts
windowHandler? WindowHandlerInput Custom handlers that the SDK should use when trying to access Window APIs In most cases you should not need to provide these. When provided, the SDK will rely on these functions instead of using any Window APIs directly When using this feature, take extra care to use the correct function version (async/async). The interface by default uses async versions of the functions when possible but specific parts of the SDK may rely on using the sync versions instead. tmp/supertokens-web-js/lib/ts/types.ts

SuperTokensConfigWithNormalisedAppInfo

type SuperTokensConfigWithNormalisedAppInfo = Omit<SuperTokensConfig, "appInfo"> & object;

Defined in: tmp/supertokens-web-js/lib/ts/types.ts

Type Declaration


SuperTokensPlugin

type SuperTokensPlugin = object;

Defined in: tmp/supertokens-web-js/lib/ts/types.ts

Properties

Property Type Defined in
compatibleWebJSSDKVersions? string | string[] tmp/supertokens-web-js/lib/ts/types.ts
config? (config) => | Omit<SuperTokensPublicConfig, "appInfo"> | undefined tmp/supertokens-web-js/lib/ts/types.ts
dependencies? (config, pluginsAbove, sdkVersion) => | { pluginsToAdd?: SuperTokensPlugin[]; status: "OK"; } | { message: string; status: "ERROR"; } tmp/supertokens-web-js/lib/ts/types.ts
exports? Record<string, any> tmp/supertokens-web-js/lib/ts/types.ts
id string tmp/supertokens-web-js/lib/ts/types.ts
init? (config, plugins, sdkVersion) => void tmp/supertokens-web-js/lib/ts/types.ts
overrideMap? { [recipeId in keyof AllRecipeConfigs]?: RecipePluginOverride<recipeId> & { recipeInitRequired?: boolean | ((sdkVersion: string) => boolean) } } tmp/supertokens-web-js/lib/ts/types.ts
version? string tmp/supertokens-web-js/lib/ts/types.ts

SuperTokensPublicConfig

type SuperTokensPublicConfig = Omit<Omit<SuperTokensConfig, NonPublicConfigPropertiesType>, "appInfo"> & object;

Defined in: tmp/supertokens-web-js/lib/ts/types.ts

Type Declaration


SuperTokensPublicPlugin

type SuperTokensPublicPlugin = Pick<SuperTokensPlugin, "id" | "version" | "exports" | "compatibleWebJSSDKVersions"> & object;

Defined in: tmp/supertokens-web-js/lib/ts/types.ts

Type Declaration

Name Type Defined in
initialized boolean tmp/supertokens-web-js/lib/ts/types.ts

User

type User = object;

Defined in: tmp/supertokens-web-js/lib/ts/types.ts

Properties

Variables

nonPublicConfigProperties

const nonPublicConfigProperties: readonly ["experimental"];

Defined in: tmp/supertokens-web-js/lib/ts/types.ts

API reference

API schema and response details