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

Properties

Apple: ((config: TypeThirdPartyProviderAppleConfig) => TypeProvider) = thirdPartyProviders.Apple

Type declaration

    • Parameters

      • config: TypeThirdPartyProviderAppleConfig

      Returns TypeProvider

Discord: ((config: TypeThirdPartyProviderDiscordConfig) => TypeProvider) = thirdPartyProviders.Discord

Type declaration

    • Parameters

      • config: TypeThirdPartyProviderDiscordConfig

      Returns TypeProvider

Error: typeof default = SuperTokensError
Facebook: ((config: TypeThirdPartyProviderFacebookConfig) => TypeProvider) = thirdPartyProviders.Facebook

Type declaration

    • (config: TypeThirdPartyProviderFacebookConfig): TypeProvider
    • Parameters

      • config: TypeThirdPartyProviderFacebookConfig

      Returns TypeProvider

Github: ((config: TypeThirdPartyProviderGithubConfig) => TypeProvider) = thirdPartyProviders.Github

Type declaration

    • Parameters

      • config: TypeThirdPartyProviderGithubConfig

      Returns TypeProvider

Google: ((config: TypeThirdPartyProviderGoogleConfig) => TypeProvider) = thirdPartyProviders.Google

Type declaration

    • Parameters

      • config: TypeThirdPartyProviderGoogleConfig

      Returns TypeProvider

GoogleWorkspaces: ((config: TypeThirdPartyProviderGoogleWorkspacesConfig) => TypeProvider) = thirdPartyProviders.GoogleWorkspaces

Type declaration

    • (config: TypeThirdPartyProviderGoogleWorkspacesConfig): TypeProvider
    • Parameters

      • config: TypeThirdPartyProviderGoogleWorkspacesConfig

      Returns TypeProvider

init: ((config: TypeInput) => RecipeListFunction) = Recipe.init

Type declaration

    • (config: TypeInput): RecipeListFunction
    • Parameters

      • config: TypeInput

      Returns RecipeListFunction

Methods

  • consumeCode(input: { deviceId: string; preAuthSessionId: string; userContext?: any; userInputCode: string } | { linkCode: string; preAuthSessionId: string; userContext?: any }): Promise<{ createdNewUser: boolean; status: "OK"; user: User } | { failedCodeInputAttemptCount: number; maximumCodeInputAttempts: number; status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR" } | { status: "RESTART_FLOW_ERROR" }>
  • Parameters

    • input: { deviceId: string; preAuthSessionId: string; userContext?: any; userInputCode: string } | { linkCode: string; preAuthSessionId: string; userContext?: any }

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

  • createCode(input: { email: string } & { userContext?: any; userInputCode?: string } | { phoneNumber: string } & { userContext?: any; userInputCode?: string }): Promise<{ codeId: string; codeLifetime: number; deviceId: string; linkCode: string; preAuthSessionId: string; status: "OK"; timeCreated: number; userInputCode: string }>
  • Parameters

    • input: { email: string } & { userContext?: any; userInputCode?: string } | { phoneNumber: string } & { userContext?: any; userInputCode?: string }

    Returns Promise<{ codeId: string; codeLifetime: number; deviceId: string; linkCode: string; preAuthSessionId: string; status: "OK"; timeCreated: number; userInputCode: string }>

  • createEmailVerificationToken(userId: string, userContext?: any): Promise<{ status: "OK"; token: string } | { status: "EMAIL_ALREADY_VERIFIED_ERROR" }>
  • createMagicLink(input: { email: string; userContext?: any } | { phoneNumber: string; userContext?: any }): Promise<string>
  • createNewCodeForDevice(input: { deviceId: string; userContext?: any; userInputCode?: string }): Promise<{ codeId: string; codeLifetime: number; deviceId: string; linkCode: string; preAuthSessionId: string; status: "OK"; timeCreated: number; userInputCode: string } | { status: "RESTART_FLOW_ERROR" | "USER_INPUT_CODE_ALREADY_USED_ERROR" }>
  • Parameters

    • input: { deviceId: string; userContext?: any; userInputCode?: string }
      • deviceId: string
      • Optional userContext?: any
      • Optional userInputCode?: string

    Returns Promise<{ codeId: string; codeLifetime: number; deviceId: string; linkCode: string; preAuthSessionId: string; status: "OK"; timeCreated: number; userInputCode: string } | { status: "RESTART_FLOW_ERROR" | "USER_INPUT_CODE_ALREADY_USED_ERROR" }>

  • getUserById(userId: string, userContext?: any): Promise<undefined | { email?: string; phoneNumber?: string } & { id: string; timeJoined: number } | { email: string; thirdParty: { id: string; userId: string } } & { id: string; timeJoined: number }>
  • Parameters

    • userId: string
    • userContext: any = {}

    Returns Promise<undefined | { email?: string; phoneNumber?: string } & { id: string; timeJoined: number } | { email: string; thirdParty: { id: string; userId: string } } & { id: string; timeJoined: number }>

  • getUserByPhoneNumber(input: { phoneNumber: string; userContext?: any }): Promise<undefined | { email?: string; phoneNumber?: string } & { id: string; timeJoined: number } | { email: string; thirdParty: { id: string; userId: string } } & { id: string; timeJoined: number }>
  • Parameters

    • input: { phoneNumber: string; userContext?: any }
      • phoneNumber: string
      • Optional userContext?: any

    Returns Promise<undefined | { email?: string; phoneNumber?: string } & { id: string; timeJoined: number } | { email: string; thirdParty: { id: string; userId: string } } & { id: string; timeJoined: number }>

  • getUserByThirdPartyInfo(thirdPartyId: string, thirdPartyUserId: string, userContext?: any): Promise<undefined | { email?: string; phoneNumber?: string } & { id: string; timeJoined: number } | { email: string; thirdParty: { id: string; userId: string } } & { id: string; timeJoined: number }>
  • Parameters

    • thirdPartyId: string
    • thirdPartyUserId: string
    • userContext: any = {}

    Returns Promise<undefined | { email?: string; phoneNumber?: string } & { id: string; timeJoined: number } | { email: string; thirdParty: { id: string; userId: string } } & { id: string; timeJoined: number }>

  • getUsersByEmail(email: string, userContext?: any): Promise<User[]>
  • isEmailVerified(userId: string, userContext?: any): Promise<boolean>
  • listCodesByDeviceId(input: { deviceId: string; userContext?: any }): Promise<undefined | DeviceType>
  • listCodesByEmail(input: { email: string; userContext?: any }): Promise<DeviceType[]>
  • listCodesByPhoneNumber(input: { phoneNumber: string; userContext?: any }): Promise<DeviceType[]>
  • listCodesByPreAuthSessionId(input: { preAuthSessionId: string; userContext?: any }): Promise<undefined | DeviceType>
  • passwordlessSignInUp(input: { email: string; userContext?: any } | { phoneNumber: string; userContext?: any }): Promise<{ createdNewUser: boolean; status: string; user: User }>
  • revokeAllCodes(input: { email: string; userContext?: any } | { phoneNumber: string; userContext?: any }): Promise<{ status: "OK" }>
  • revokeCode(input: { codeId: string; userContext?: any }): Promise<{ status: "OK" }>
  • revokeEmailVerificationTokens(userId: string, userContext?: any): Promise<{ status: "OK" }>
  • sendEmail(input: TypeEmailVerificationEmailDeliveryInput & { userContext?: any } | TypePasswordlessEmailDeliveryInput & { userContext?: any }): Promise<void>
  • sendSms(input: TypePasswordlessSmsDeliveryInput & { userContext?: any }): Promise<void>
  • thirdPartySignInUp(thirdPartyId: string, thirdPartyUserId: string, email: { id: string; isVerified: boolean }, userContext?: any): Promise<{ createdNewUser: boolean; status: "OK"; user: User }>
  • Parameters

    • thirdPartyId: string
    • thirdPartyUserId: string
    • email: { id: string; isVerified: boolean }
      • id: string
      • isVerified: boolean
    • userContext: any = {}

    Returns Promise<{ createdNewUser: boolean; status: "OK"; user: User }>

  • unverifyEmail(userId: string, userContext?: any): Promise<{ status: "OK" }>
  • updatePasswordlessUser(input: { email?: (null) | string; phoneNumber?: (null) | string; userContext?: any; userId: string }): Promise<{ status: "OK" | "EMAIL_ALREADY_EXISTS_ERROR" | "UNKNOWN_USER_ID_ERROR" | "PHONE_NUMBER_ALREADY_EXISTS_ERROR" }>
  • Parameters

    • input: { email?: (null) | string; phoneNumber?: (null) | string; userContext?: any; userId: string }
      • Optional email?: (null) | string
      • Optional phoneNumber?: (null) | string
      • Optional userContext?: any
      • userId: string

    Returns Promise<{ status: "OK" | "EMAIL_ALREADY_EXISTS_ERROR" | "UNKNOWN_USER_ID_ERROR" | "PHONE_NUMBER_ALREADY_EXISTS_ERROR" }>

  • verifyEmailUsingToken(token: string, userContext?: any): Promise<undefined | { status: "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR" } | { email?: string; phoneNumber?: string } & { id: string; timeJoined: number } | { email: string; thirdParty: { id: string; userId: string } } & { id: string; timeJoined: number }>
  • Parameters

    • token: string
    • userContext: any = {}

    Returns Promise<undefined | { status: "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR" } | { email?: string; phoneNumber?: string } & { id: string; timeJoined: number } | { email: string; thirdParty: { id: string; userId: string } } & { id: string; timeJoined: number }>

Generated using TypeDoc