Options
All
  • Public
  • Public/Protected
  • All
Menu

These are the SDK reference docs. If you’re looking for docs to implement SuperTokens, you might want to check out the User Guides

Hierarchy

  • default

Index

Constructors

Methods

  • clearLoginAttemptInfo(input?: { userContext?: any }): Promise<void>
  • Clear any information about login attempts from storage

    Parameters

    • Optional input: { userContext?: any }
      • Optional userContext?: any

    Returns Promise<void>

  • consumeCode(input?: { options?: RecipeFunctionOptions; userContext?: any; userInputCode: string } | { options?: RecipeFunctionOptions; userContext?: any }): Promise<{ createdNewUser: boolean; fetchResponse: Response; status: "OK"; user: PasswordlessUser } | { failedCodeInputAttemptCount: number; fetchResponse: Response; maximumCodeInputAttempts: number; status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR" } | { fetchResponse: Response; status: "RESTART_FLOW_ERROR" }>
  • Log the user in using the input code or link code

    throws

    STGeneralError if the API exposed by the backend SDKs returns status: "GENERAL_ERROR"

    Parameters

    Returns Promise<{ createdNewUser: boolean; fetchResponse: Response; status: "OK"; user: PasswordlessUser } | { failedCodeInputAttemptCount: number; fetchResponse: Response; maximumCodeInputAttempts: number; status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR" } | { fetchResponse: Response; status: "RESTART_FLOW_ERROR" }>

    {status: "OK", user, createdNewUser: bool} if succesful

  • Create and send a code to the user for passwordless auth

    throws

    STGeneralError if the API exposed by the backend SDKs returns status: "GENERAL_ERROR"

    Parameters

    Returns Promise<{ deviceId: string; fetchResponse: Response; flowType: PasswordlessFlowType; preAuthSessionId: string; status: "OK" }>

    {status: "OK", deviceId, preAuthSessionId, flowType} If successful

  • doesEmailExist(input: { email: string; options?: RecipeFunctionOptions; userContext?: any }): Promise<{ doesExist: boolean; fetchResponse: Response; status: "OK" }>
  • Check if a user with the given email exists

    throws

    STGeneralError if the API exposed by the backend SDKs returns status: "GENERAL_ERROR"

    Parameters

    Returns Promise<{ doesExist: boolean; fetchResponse: Response; status: "OK" }>

    {status: "OK", doesExist: boolean}

  • doesPhoneNumberExist(input: { options?: RecipeFunctionOptions; phoneNumber: string; userContext?: any }): Promise<{ doesExist: boolean; fetchResponse: Response; status: "OK" }>
  • Check if a user with the given phone number exists

    throws

    STGeneralError if the API exposed by the backend SDKs returns status: "GENERAL_ERROR"

    Parameters

    Returns Promise<{ doesExist: boolean; fetchResponse: Response; status: "OK" }>

    {status: "OK", doesExist: boolean}

  • getLinkCodeFromURL(input?: { userContext?: any }): string
  • Reads and returns the link code from the current URL

    Parameters

    • Optional input: { userContext?: any }
      • Optional userContext?: any

    Returns string

    The hash (#) property of the current URL

  • getLoginAttemptInfo<CustomLoginAttemptInfoProperties>(input?: { userContext?: any }): Promise<undefined | { deviceId: string; flowType: PasswordlessFlowType; preAuthSessionId: string } & CustomLoginAttemptInfoProperties>
  • Get information about the current login attempt from storage

    Type Parameters

    • CustomLoginAttemptInfoProperties

    Parameters

    • Optional input: { userContext?: any }
      • Optional userContext?: any

    Returns Promise<undefined | { deviceId: string; flowType: PasswordlessFlowType; preAuthSessionId: string } & CustomLoginAttemptInfoProperties>

    {deviceId, preAuthSessionId, flowType} if present, returns undefined otherwise

  • getPreAuthSessionIdFromURL(input?: { userContext?: any }): string
  • Reads and returns the pre auth session id from the current URL

    Parameters

    • Optional input: { userContext?: any }
      • Optional userContext?: any

    Returns string

    The "preAuthSessionId" query parameter from the current URL

  • resendCode(input?: { options?: RecipeFunctionOptions; userContext?: any }): Promise<{ fetchResponse: Response; status: "OK" | "RESTART_FLOW_ERROR" }>
  • Resend the code to the user

    throws

    STGeneralError if the API exposed by the backend SDKs returns status: "GENERAL_ERROR"

    Parameters

    Returns Promise<{ fetchResponse: Response; status: "OK" | "RESTART_FLOW_ERROR" }>

    {status: "OK"} if succesful

  • setLoginAttemptInfo<CustomStateProperties>(input: { attemptInfo: { deviceId: string; flowType: PasswordlessFlowType; preAuthSessionId: string } & CustomStateProperties; userContext?: any }): Promise<void>
  • Set information about the current login attempt to storage

    Type Parameters

    • CustomStateProperties

    Parameters

    • input: { attemptInfo: { deviceId: string; flowType: PasswordlessFlowType; preAuthSessionId: string } & CustomStateProperties; userContext?: any }
      • attemptInfo: { deviceId: string; flowType: PasswordlessFlowType; preAuthSessionId: string } & CustomStateProperties
      • Optional userContext?: any

    Returns Promise<void>

  • signOut(input?: { userContext?: any }): Promise<void>

Generated using TypeDoc