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

Module recipe/thirdpartypasswordless

Index

References

Re-exports TypeProvider

Type Aliases

APIInterface: { appleRedirectHandlerPOST: undefined | ((input: { code: string; options: ThirdPartyAPIOptions; state: string; userContext: any }) => Promise<void>); authorisationUrlGET: undefined | ((input: { options: ThirdPartyAPIOptions; provider: TypeProvider; userContext: any }) => Promise<{ status: "OK"; url: string } | GeneralErrorResponse>); consumeCodePOST: undefined | ((input: ({ deviceId: string; preAuthSessionId: string; userInputCode: string } | { linkCode: string; preAuthSessionId: string }) & { options: PasswordlessAPIOptions; userContext: any }) => Promise<{ createdNewUser: boolean; session: SessionContainer; status: "OK"; user: User } | { failedCodeInputAttemptCount: number; maximumCodeInputAttempts: number; status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR" } | GeneralErrorResponse | { status: "RESTART_FLOW_ERROR" }>); createCodePOST: undefined | ((input: ({ email: string } | { phoneNumber: string }) & { options: PasswordlessAPIOptions; userContext: any }) => Promise<{ deviceId: string; flowType: "USER_INPUT_CODE" | "MAGIC_LINK" | "USER_INPUT_CODE_AND_MAGIC_LINK"; preAuthSessionId: string; status: "OK" } | GeneralErrorResponse>); passwordlessUserEmailExistsGET: undefined | ((input: { email: string; options: PasswordlessAPIOptions; userContext: any }) => Promise<{ exists: boolean; status: "OK" } | GeneralErrorResponse>); passwordlessUserPhoneNumberExistsGET: undefined | ((input: { options: PasswordlessAPIOptions; phoneNumber: string; userContext: any }) => Promise<{ exists: boolean; status: "OK" } | GeneralErrorResponse>); resendCodePOST: undefined | ((input: { deviceId: string; preAuthSessionId: string } & { options: PasswordlessAPIOptions; userContext: any }) => Promise<GeneralErrorResponse | { status: "RESTART_FLOW_ERROR" | "OK" }>); thirdPartySignInUpPOST: undefined | ((input: { authCodeResponse?: any; clientId?: string; code: string; options: ThirdPartyAPIOptions; provider: TypeProvider; redirectURI: string; userContext: any }) => Promise<{ authCodeResponse: any; createdNewUser: boolean; session: SessionContainer; status: "OK"; user: User } | GeneralErrorResponse | { status: "NO_EMAIL_GIVEN_BY_PROVIDER" }>) }

Type declaration

  • appleRedirectHandlerPOST: undefined | ((input: { code: string; options: ThirdPartyAPIOptions; state: string; userContext: any }) => Promise<void>)
  • authorisationUrlGET: undefined | ((input: { options: ThirdPartyAPIOptions; provider: TypeProvider; userContext: any }) => Promise<{ status: "OK"; url: string } | GeneralErrorResponse>)
  • consumeCodePOST: undefined | ((input: ({ deviceId: string; preAuthSessionId: string; userInputCode: string } | { linkCode: string; preAuthSessionId: string }) & { options: PasswordlessAPIOptions; userContext: any }) => Promise<{ createdNewUser: boolean; session: SessionContainer; status: "OK"; user: User } | { failedCodeInputAttemptCount: number; maximumCodeInputAttempts: number; status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR" } | GeneralErrorResponse | { status: "RESTART_FLOW_ERROR" }>)
  • createCodePOST: undefined | ((input: ({ email: string } | { phoneNumber: string }) & { options: PasswordlessAPIOptions; userContext: any }) => Promise<{ deviceId: string; flowType: "USER_INPUT_CODE" | "MAGIC_LINK" | "USER_INPUT_CODE_AND_MAGIC_LINK"; preAuthSessionId: string; status: "OK" } | GeneralErrorResponse>)
  • passwordlessUserEmailExistsGET: undefined | ((input: { email: string; options: PasswordlessAPIOptions; userContext: any }) => Promise<{ exists: boolean; status: "OK" } | GeneralErrorResponse>)
  • passwordlessUserPhoneNumberExistsGET: undefined | ((input: { options: PasswordlessAPIOptions; phoneNumber: string; userContext: any }) => Promise<{ exists: boolean; status: "OK" } | GeneralErrorResponse>)
  • resendCodePOST: undefined | ((input: { deviceId: string; preAuthSessionId: string } & { options: PasswordlessAPIOptions; userContext: any }) => Promise<GeneralErrorResponse | { status: "RESTART_FLOW_ERROR" | "OK" }>)
  • thirdPartySignInUpPOST: undefined | ((input: { authCodeResponse?: any; clientId?: string; code: string; options: ThirdPartyAPIOptions; provider: TypeProvider; redirectURI: string; userContext: any }) => Promise<{ authCodeResponse: any; createdNewUser: boolean; session: SessionContainer; status: "OK"; user: User } | GeneralErrorResponse | { status: "NO_EMAIL_GIVEN_BY_PROVIDER" }>)
PasswordlessAPIOptions: APIOptions
RecipeInterface: { consumeCode: any; createCode: any; createNewCodeForDevice: any; getUserById: any; getUserByPhoneNumber: any; getUserByThirdPartyInfo: any; getUsersByEmail: any; listCodesByDeviceId: any; listCodesByEmail: any; listCodesByPhoneNumber: any; listCodesByPreAuthSessionId: any; revokeAllCodes: any; revokeCode: any; thirdPartySignInUp: any; updatePasswordlessUser: any }

Type declaration

  • consumeCode:function
    • 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:function
    • 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 }>

  • createNewCodeForDevice:function
    • 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
        • 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:function
    • getUserById(input: { userContext: any; userId: string }): Promise<undefined | { email?: string; phoneNumber?: string } & { id: string; timeJoined: number } | { email: string; thirdParty: { id: string; userId: string } } & { id: string; timeJoined: number }>
    • Parameters

      • input: { userContext: any; userId: string }
        • userContext: any
        • userId: string

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

  • getUserByPhoneNumber:function
    • 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
        • 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:function
    • getUserByThirdPartyInfo(input: { 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

      • input: { thirdPartyId: string; thirdPartyUserId: string; userContext: any }
        • 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:function
    • getUsersByEmail(input: { email: string; userContext: any }): Promise<User[]>
  • listCodesByDeviceId:function
    • listCodesByDeviceId(input: { deviceId: string; userContext: any }): Promise<undefined | DeviceType>
  • listCodesByEmail:function
    • listCodesByEmail(input: { email: string; userContext: any }): Promise<DeviceType[]>
  • listCodesByPhoneNumber:function
    • listCodesByPhoneNumber(input: { phoneNumber: string; userContext: any }): Promise<DeviceType[]>
  • listCodesByPreAuthSessionId:function
    • listCodesByPreAuthSessionId(input: { preAuthSessionId: string; userContext: any }): Promise<undefined | DeviceType>
  • revokeAllCodes:function
    • revokeAllCodes(input: { email: string; userContext: any } | { phoneNumber: string; userContext: any }): Promise<{ status: "OK" }>
  • revokeCode:function
    • revokeCode(input: { codeId: string; userContext: any }): Promise<{ status: "OK" }>
  • thirdPartySignInUp:function
    • thirdPartySignInUp(input: { email: { id: string; isVerified: boolean }; thirdPartyId: string; thirdPartyUserId: string; userContext: any }): Promise<{ createdNewUser: boolean; status: "OK"; user: User }>
    • Parameters

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

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

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

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

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

ThirdPartyAPIOptions: APIOptions
User: ({ email?: string; phoneNumber?: string } | { email: string; thirdParty: { id: string; userId: string } }) & { id: string; timeJoined: number }

Variables

Error: typeof default = Wrapper.Error

Functions

  • Apple(config: TypeThirdPartyProviderAppleConfig): TypeProvider
  • Discord(config: TypeThirdPartyProviderDiscordConfig): TypeProvider
  • Facebook(config: TypeThirdPartyProviderFacebookConfig): TypeProvider
  • Github(config: TypeThirdPartyProviderGithubConfig): TypeProvider
  • Google(config: TypeThirdPartyProviderGoogleConfig): TypeProvider
  • GoogleWorkspaces(config: TypeThirdPartyProviderGoogleWorkspacesConfig): TypeProvider
  • 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[]>
  • init(config: TypeInput): RecipeListFunction
  • 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