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/thirdpartyemailpassword

Index

References

TypeProvider

Re-exports TypeProvider

Type aliases

APIInterface

APIInterface: { appleRedirectHandlerPOST: undefined | ((input: { code: string; options: ThirdPartyAPIOptions; state: string }) => Promise<void>); authorisationUrlGET: undefined | ((input: { options: ThirdPartyAPIOptions; provider: TypeProvider }) => Promise<{ status: "OK"; url: string }>); emailExistsGET: undefined | ((input: { email: string; options: EmailPasswordAPIOptions }) => Promise<{ exists: boolean; status: "OK" }>); emailPasswordSignInPOST: undefined | ((input: { formFields: { id: string; value: string }[]; options: EmailPasswordAPIOptions }) => Promise<{ status: "OK"; user: User } | { status: "WRONG_CREDENTIALS_ERROR" }>); emailPasswordSignUpPOST: undefined | ((input: { formFields: { id: string; value: string }[]; options: EmailPasswordAPIOptions }) => Promise<{ status: "OK"; user: User } | { status: "EMAIL_ALREADY_EXISTS_ERROR" }>); generatePasswordResetTokenPOST: undefined | ((input: { formFields: { id: string; value: string }[]; options: EmailPasswordAPIOptions }) => Promise<{ status: "OK" }>); passwordResetPOST: undefined | ((input: { formFields: { id: string; value: string }[]; options: EmailPasswordAPIOptions; token: string }) => Promise<{ status: "OK"; userId?: string } | { status: "RESET_PASSWORD_INVALID_TOKEN_ERROR" }>); thirdPartySignInUpPOST: undefined | ((input: { authCodeResponse?: any; clientId?: string; code: string; options: ThirdPartyAPIOptions; provider: TypeProvider; redirectURI: string }) => Promise<{ authCodeResponse: any; createdNewUser: boolean; status: "OK"; user: User } | { error: string; status: "FIELD_ERROR" } | { status: "NO_EMAIL_GIVEN_BY_PROVIDER" }>) }

Type declaration

  • appleRedirectHandlerPOST: undefined | ((input: { code: string; options: ThirdPartyAPIOptions; state: string }) => Promise<void>)
  • authorisationUrlGET: undefined | ((input: { options: ThirdPartyAPIOptions; provider: TypeProvider }) => Promise<{ status: "OK"; url: string }>)
  • emailExistsGET: undefined | ((input: { email: string; options: EmailPasswordAPIOptions }) => Promise<{ exists: boolean; status: "OK" }>)
  • emailPasswordSignInPOST: undefined | ((input: { formFields: { id: string; value: string }[]; options: EmailPasswordAPIOptions }) => Promise<{ status: "OK"; user: User } | { status: "WRONG_CREDENTIALS_ERROR" }>)
  • emailPasswordSignUpPOST: undefined | ((input: { formFields: { id: string; value: string }[]; options: EmailPasswordAPIOptions }) => Promise<{ status: "OK"; user: User } | { status: "EMAIL_ALREADY_EXISTS_ERROR" }>)
  • generatePasswordResetTokenPOST: undefined | ((input: { formFields: { id: string; value: string }[]; options: EmailPasswordAPIOptions }) => Promise<{ status: "OK" }>)
  • passwordResetPOST: undefined | ((input: { formFields: { id: string; value: string }[]; options: EmailPasswordAPIOptions; token: string }) => Promise<{ status: "OK"; userId?: string } | { status: "RESET_PASSWORD_INVALID_TOKEN_ERROR" }>)
  • thirdPartySignInUpPOST: undefined | ((input: { authCodeResponse?: any; clientId?: string; code: string; options: ThirdPartyAPIOptions; provider: TypeProvider; redirectURI: string }) => Promise<{ authCodeResponse: any; createdNewUser: boolean; status: "OK"; user: User } | { error: string; status: "FIELD_ERROR" } | { status: "NO_EMAIL_GIVEN_BY_PROVIDER" }>)

EmailPasswordAPIOptions

EmailPasswordAPIOptions: APIOptions

RecipeInterface

RecipeInterface: { createResetPasswordToken: any; getUserById: any; getUserByThirdPartyInfo: any; getUsersByEmail: any; resetPasswordUsingToken: any; signIn: any; signInUp: any; signUp: any; updateEmailOrPassword: any }

Type declaration

  • createResetPasswordToken:function
    • createResetPasswordToken(input: { userId: string }): Promise<{ status: "OK"; token: string } | { status: "UNKNOWN_USER_ID_ERROR" }>
  • getUserById:function
    • getUserById(input: { userId: string }): Promise<undefined | User>
  • getUserByThirdPartyInfo:function
    • getUserByThirdPartyInfo(input: { thirdPartyId: string; thirdPartyUserId: string }): Promise<undefined | User>
  • getUsersByEmail:function
    • getUsersByEmail(input: { email: string }): Promise<User[]>
  • resetPasswordUsingToken:function
    • resetPasswordUsingToken(input: { newPassword: string; token: string }): Promise<{ status: "OK"; userId?: string } | { status: "RESET_PASSWORD_INVALID_TOKEN_ERROR" }>
  • signIn:function
    • signIn(input: { email: string; password: string }): Promise<{ status: "OK"; user: User } | { status: "WRONG_CREDENTIALS_ERROR" }>
  • signInUp:function
    • signInUp(input: { email: { id: string; isVerified: boolean }; thirdPartyId: string; thirdPartyUserId: string }): Promise<{ createdNewUser: boolean; status: "OK"; user: User } | { error: string; status: "FIELD_ERROR" }>
    • Parameters

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

      Returns Promise<{ createdNewUser: boolean; status: "OK"; user: User } | { error: string; status: "FIELD_ERROR" }>

  • signUp:function
    • signUp(input: { email: string; password: string }): Promise<{ status: "OK"; user: User } | { status: "EMAIL_ALREADY_EXISTS_ERROR" }>
  • updateEmailOrPassword:function
    • updateEmailOrPassword(input: { email?: string; password?: string; userId: string }): Promise<{ status: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR" }>
    • Parameters

      • input: { email?: string; password?: string; userId: string }
        • Optional email?: string
        • Optional password?: string
        • userId: string

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

ThirdPartyAPIOptions

ThirdPartyAPIOptions: APIOptions

User

User: { email: string; id: string; thirdParty?: { id: string; userId: string }; timeJoined: number }

Type declaration

  • email: string
  • id: string
  • Optional thirdParty?: { id: string; userId: string }
    • id: string
    • userId: string
  • timeJoined: number

Variables

Error

Error: typeof default = ...

Functions

Apple

  • Apple(config: TypeThirdPartyProviderAppleConfig): TypeProvider

Discord

  • Discord(config: TypeThirdPartyProviderDiscordConfig): TypeProvider

Facebook

  • Facebook(config: TypeThirdPartyProviderFacebookConfig): TypeProvider

Github

  • Github(config: TypeThirdPartyProviderGithubConfig): TypeProvider

Google

  • Google(config: TypeThirdPartyProviderGoogleConfig): TypeProvider

GoogleWorkspaces

  • GoogleWorkspaces(config: TypeThirdPartyProviderGoogleWorkspacesConfig): TypeProvider

createEmailVerificationToken

  • createEmailVerificationToken(userId: string): Promise<{ status: "OK"; token: string } | { status: "EMAIL_ALREADY_VERIFIED_ERROR" }>

createResetPasswordToken

  • createResetPasswordToken(userId: string): Promise<{ status: "OK"; token: string } | { status: "UNKNOWN_USER_ID_ERROR" }>

getUserById

  • getUserById(userId: string): Promise<undefined | User>

getUserByThirdPartyInfo

  • getUserByThirdPartyInfo(thirdPartyId: string, thirdPartyUserId: string): Promise<undefined | User>

getUsersByEmail

  • getUsersByEmail(email: string): Promise<User[]>

init

  • init(config: TypeInput): RecipeListFunction

isEmailVerified

  • isEmailVerified(userId: string): Promise<boolean>

resetPasswordUsingToken

  • resetPasswordUsingToken(token: string, newPassword: string): Promise<{ status: "OK"; userId?: string } | { status: "RESET_PASSWORD_INVALID_TOKEN_ERROR" }>

revokeEmailVerificationTokens

  • revokeEmailVerificationTokens(userId: string): Promise<{ status: "OK" }>

signIn

  • signIn(email: string, password: string): Promise<{ status: "OK"; user: User } | { status: "WRONG_CREDENTIALS_ERROR" }>

signInUp

  • signInUp(thirdPartyId: string, thirdPartyUserId: string, email: { id: string; isVerified: boolean }): Promise<{ createdNewUser: boolean; status: "OK"; user: User } | { error: string; status: "FIELD_ERROR" }>
  • Parameters

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

    Returns Promise<{ createdNewUser: boolean; status: "OK"; user: User } | { error: string; status: "FIELD_ERROR" }>

signUp

  • signUp(email: string, password: string): Promise<{ status: "OK"; user: User } | { status: "EMAIL_ALREADY_EXISTS_ERROR" }>

unverifyEmail

  • unverifyEmail(userId: string): Promise<{ status: "OK" }>

updateEmailOrPassword

  • updateEmailOrPassword(input: { email?: string; password?: string; userId: string }): Promise<{ status: "OK" | "EMAIL_ALREADY_EXISTS_ERROR" | "UNKNOWN_USER_ID_ERROR" }>
  • Parameters

    • input: { email?: string; password?: string; userId: string }
      • Optional email?: string
      • Optional password?: string
      • userId: string

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

verifyEmailUsingToken

  • verifyEmailUsingToken(token: string): Promise<undefined | { status: "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR" } | User>

Generated using TypeDoc