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

Re-exports TypeProvider

Type aliases

APIInterface: { appleRedirectHandlerPOST: undefined | ((input: { formPostInfoFromProvider: any; options: ThirdPartyAPIOptions; userContext: any }) => Promise<void>); authorisationUrlGET: undefined | ((input: { options: ThirdPartyAPIOptions; provider: TypeProvider; redirectURIOnProviderDashboard: string; tenantId: string; userContext: any }) => Promise<{ pkceCodeVerifier?: string; status: "OK"; urlWithQueryParams: string } | GeneralErrorResponse>); emailPasswordEmailExistsGET: undefined | ((input: { email: string; options: EmailPasswordAPIOptions; tenantId: string; userContext: any }) => Promise<{ exists: boolean; status: "OK" } | GeneralErrorResponse>); emailPasswordSignInPOST: undefined | ((input: { formFields: { id: string; value: string }[]; options: EmailPasswordAPIOptions; tenantId: string; userContext: any }) => Promise<{ session: SessionContainer; status: "OK"; user: User } | { status: "WRONG_CREDENTIALS_ERROR" } | GeneralErrorResponse>); emailPasswordSignUpPOST: undefined | ((input: { formFields: { id: string; value: string }[]; options: EmailPasswordAPIOptions; tenantId: string; userContext: any }) => Promise<{ session: SessionContainer; status: "OK"; user: User } | { status: "EMAIL_ALREADY_EXISTS_ERROR" } | GeneralErrorResponse>); generatePasswordResetTokenPOST: undefined | ((input: { formFields: { id: string; value: string }[]; options: EmailPasswordAPIOptions; tenantId: string; userContext: any }) => Promise<{ status: "OK" } | GeneralErrorResponse>); passwordResetPOST: undefined | ((input: { formFields: { id: string; value: string }[]; options: EmailPasswordAPIOptions; tenantId: string; token: string; userContext: any }) => Promise<{ status: "OK"; userId?: string } | { status: "RESET_PASSWORD_INVALID_TOKEN_ERROR" } | GeneralErrorResponse>); thirdPartySignInUpPOST: undefined | ((input: { options: ThirdPartyAPIOptions; provider: TypeProvider; tenantId: string; userContext: any } & ({ redirectURIInfo: { pkceCodeVerifier?: string; redirectURIOnProviderDashboard: string; redirectURIQueryParams: any } } | { oAuthTokens: {} })) => Promise<{ createdNewUser: boolean; oAuthTokens: {}; rawUserInfoFromProvider: { fromIdTokenPayload?: {}; fromUserInfoAPI?: {} }; session: SessionContainer; status: "OK"; user: User } | { status: "NO_EMAIL_GIVEN_BY_PROVIDER" } | GeneralErrorResponse>) }

Type declaration

  • appleRedirectHandlerPOST: undefined | ((input: { formPostInfoFromProvider: any; options: ThirdPartyAPIOptions; userContext: any }) => Promise<void>)
  • authorisationUrlGET: undefined | ((input: { options: ThirdPartyAPIOptions; provider: TypeProvider; redirectURIOnProviderDashboard: string; tenantId: string; userContext: any }) => Promise<{ pkceCodeVerifier?: string; status: "OK"; urlWithQueryParams: string } | GeneralErrorResponse>)
  • emailPasswordEmailExistsGET: undefined | ((input: { email: string; options: EmailPasswordAPIOptions; tenantId: string; userContext: any }) => Promise<{ exists: boolean; status: "OK" } | GeneralErrorResponse>)
  • emailPasswordSignInPOST: undefined | ((input: { formFields: { id: string; value: string }[]; options: EmailPasswordAPIOptions; tenantId: string; userContext: any }) => Promise<{ session: SessionContainer; status: "OK"; user: User } | { status: "WRONG_CREDENTIALS_ERROR" } | GeneralErrorResponse>)
  • emailPasswordSignUpPOST: undefined | ((input: { formFields: { id: string; value: string }[]; options: EmailPasswordAPIOptions; tenantId: string; userContext: any }) => Promise<{ session: SessionContainer; status: "OK"; user: User } | { status: "EMAIL_ALREADY_EXISTS_ERROR" } | GeneralErrorResponse>)
  • generatePasswordResetTokenPOST: undefined | ((input: { formFields: { id: string; value: string }[]; options: EmailPasswordAPIOptions; tenantId: string; userContext: any }) => Promise<{ status: "OK" } | GeneralErrorResponse>)
  • passwordResetPOST: undefined | ((input: { formFields: { id: string; value: string }[]; options: EmailPasswordAPIOptions; tenantId: string; token: string; userContext: any }) => Promise<{ status: "OK"; userId?: string } | { status: "RESET_PASSWORD_INVALID_TOKEN_ERROR" } | GeneralErrorResponse>)
  • thirdPartySignInUpPOST: undefined | ((input: { options: ThirdPartyAPIOptions; provider: TypeProvider; tenantId: string; userContext: any } & ({ redirectURIInfo: { pkceCodeVerifier?: string; redirectURIOnProviderDashboard: string; redirectURIQueryParams: any } } | { oAuthTokens: {} })) => Promise<{ createdNewUser: boolean; oAuthTokens: {}; rawUserInfoFromProvider: { fromIdTokenPayload?: {}; fromUserInfoAPI?: {} }; session: SessionContainer; status: "OK"; user: User } | { status: "NO_EMAIL_GIVEN_BY_PROVIDER" } | GeneralErrorResponse>)
EmailPasswordAPIOptions: APIOptions
RecipeInterface: { createResetPasswordToken: any; emailPasswordSignIn: any; emailPasswordSignUp: any; getUserById: any; getUserByThirdPartyInfo: any; getUsersByEmail: any; resetPasswordUsingToken: any; thirdPartyGetProvider: any; thirdPartyManuallyCreateOrUpdateUser: any; thirdPartySignInUp: any; updateEmailOrPassword: any }

Type declaration

  • createResetPasswordToken:function
    • createResetPasswordToken(input: { tenantId: string; userContext: any; userId: string }): Promise<{ status: "OK"; token: string } | { status: "UNKNOWN_USER_ID_ERROR" }>
    • Parameters

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

      Returns Promise<{ status: "OK"; token: string } | { status: "UNKNOWN_USER_ID_ERROR" }>

  • emailPasswordSignIn:function
    • emailPasswordSignIn(input: { email: string; password: string; tenantId: string; userContext: any }): Promise<{ status: "OK"; user: User } | { status: "WRONG_CREDENTIALS_ERROR" }>
    • Parameters

      • input: { email: string; password: string; tenantId: string; userContext: any }
        • email: string
        • password: string
        • tenantId: string
        • userContext: any

      Returns Promise<{ status: "OK"; user: User } | { status: "WRONG_CREDENTIALS_ERROR" }>

  • emailPasswordSignUp:function
    • emailPasswordSignUp(input: { email: string; password: string; tenantId: string; userContext: any }): Promise<{ status: "OK"; user: User } | { status: "EMAIL_ALREADY_EXISTS_ERROR" }>
    • Parameters

      • input: { email: string; password: string; tenantId: string; userContext: any }
        • email: string
        • password: string
        • tenantId: string
        • userContext: any

      Returns Promise<{ status: "OK"; user: User } | { status: "EMAIL_ALREADY_EXISTS_ERROR" }>

  • getUserById:function
    • getUserById(input: { userContext: any; userId: string }): Promise<undefined | User>
  • getUserByThirdPartyInfo:function
    • getUserByThirdPartyInfo(input: { tenantId: string; thirdPartyId: string; thirdPartyUserId: string; userContext: any }): Promise<undefined | User>
    • Parameters

      • input: { tenantId: string; thirdPartyId: string; thirdPartyUserId: string; userContext: any }
        • tenantId: string
        • thirdPartyId: string
        • thirdPartyUserId: string
        • userContext: any

      Returns Promise<undefined | User>

  • getUsersByEmail:function
    • getUsersByEmail(input: { email: string; tenantId: string; userContext: any }): Promise<User[]>
  • resetPasswordUsingToken:function
    • resetPasswordUsingToken(input: { newPassword: string; tenantId: string; token: string; userContext: any }): Promise<{ status: "OK"; userId?: string } | { status: "RESET_PASSWORD_INVALID_TOKEN_ERROR" }>
    • Parameters

      • input: { newPassword: string; tenantId: string; token: string; userContext: any }
        • newPassword: string
        • tenantId: string
        • token: string
        • userContext: any

      Returns Promise<{ status: "OK"; userId?: string } | { status: "RESET_PASSWORD_INVALID_TOKEN_ERROR" }>

  • thirdPartyGetProvider:function
    • thirdPartyGetProvider(input: { clientType?: string; tenantId: string; thirdPartyId: string; userContext: any }): Promise<undefined | TypeProvider>
  • thirdPartyManuallyCreateOrUpdateUser:function
    • thirdPartyManuallyCreateOrUpdateUser(input: { email: string; tenantId: string; thirdPartyId: string; thirdPartyUserId: string; userContext: any }): Promise<{ createdNewUser: boolean; status: "OK"; user: User }>
    • Parameters

      • input: { email: string; tenantId: string; thirdPartyId: string; thirdPartyUserId: string; userContext: any }
        • email: string
        • tenantId: string
        • thirdPartyId: string
        • thirdPartyUserId: string
        • userContext: any

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

  • thirdPartySignInUp:function
    • thirdPartySignInUp(input: { email: string; oAuthTokens: {}; rawUserInfoFromProvider: { fromIdTokenPayload?: {}; fromUserInfoAPI?: {} }; tenantId: string; thirdPartyId: string; thirdPartyUserId: string; userContext: any }): Promise<{ createdNewUser: boolean; oAuthTokens: {}; rawUserInfoFromProvider: { fromIdTokenPayload?: {}; fromUserInfoAPI?: {} }; status: "OK"; user: User }>
    • Parameters

      • input: { email: string; oAuthTokens: {}; rawUserInfoFromProvider: { fromIdTokenPayload?: {}; fromUserInfoAPI?: {} }; tenantId: string; thirdPartyId: string; thirdPartyUserId: string; userContext: any }
        • email: string
        • oAuthTokens: {}
          • [key: string]: any
        • rawUserInfoFromProvider: { fromIdTokenPayload?: {}; fromUserInfoAPI?: {} }
          • Optional fromIdTokenPayload?: {}
            • [key: string]: any
          • Optional fromUserInfoAPI?: {}
            • [key: string]: any
        • tenantId: string
        • thirdPartyId: string
        • thirdPartyUserId: string
        • userContext: any

      Returns Promise<{ createdNewUser: boolean; oAuthTokens: {}; rawUserInfoFromProvider: { fromIdTokenPayload?: {}; fromUserInfoAPI?: {} }; status: "OK"; user: User }>

  • updateEmailOrPassword:function
    • updateEmailOrPassword(input: { applyPasswordPolicy?: boolean; email?: string; password?: string; tenantIdForPasswordPolicy: string; userContext: any; userId: string }): Promise<{ status: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR" } | { failureReason: string; status: "PASSWORD_POLICY_VIOLATED_ERROR" }>
    • Parameters

      • input: { applyPasswordPolicy?: boolean; email?: string; password?: string; tenantIdForPasswordPolicy: string; userContext: any; userId: string }
        • Optional applyPasswordPolicy?: boolean
        • Optional email?: string
        • Optional password?: string
        • tenantIdForPasswordPolicy: string
        • userContext: any
        • userId: string

      Returns Promise<{ status: "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR" } | { failureReason: string; status: "PASSWORD_POLICY_VIOLATED_ERROR" }>

ThirdPartyAPIOptions: APIOptions
User: { email: string; id: string; tenantIds: string[]; thirdParty?: { id: string; userId: string }; timeJoined: number }

Type declaration

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

Variables

Error: typeof default = Wrapper.Error

Functions

  • createResetPasswordLink(tenantId: string, userId: string, userContext?: any): Promise<{ link: string; status: "OK" } | { status: "UNKNOWN_USER_ID_ERROR" }>
  • createResetPasswordToken(tenantId: string, userId: string, userContext?: any): Promise<{ status: "OK"; token: string } | { status: "UNKNOWN_USER_ID_ERROR" }>
  • emailPasswordSignIn(tenantId: string, email: string, password: string, userContext?: any): Promise<{ status: "OK"; user: User } | { status: "WRONG_CREDENTIALS_ERROR" }>
  • emailPasswordSignUp(tenantId: string, email: string, password: string, userContext?: any): Promise<{ status: "OK"; user: User } | { status: "EMAIL_ALREADY_EXISTS_ERROR" }>
  • getUserById(userId: string, userContext?: any): Promise<undefined | User>
  • getUserByThirdPartyInfo(tenantId: string, thirdPartyId: string, thirdPartyUserId: string, userContext?: any): Promise<undefined | User>
  • getUsersByEmail(tenantId: string, email: string, userContext?: any): Promise<User[]>
  • init(config?: TypeInput): RecipeListFunction
  • resetPasswordUsingToken(tenantId: string, token: string, newPassword: string, userContext?: any): Promise<{ status: "OK"; userId?: string } | { status: "RESET_PASSWORD_INVALID_TOKEN_ERROR" }>
  • sendEmail(input: TypeEmailPasswordPasswordResetEmailDeliveryInput & { userContext?: any }): Promise<void>
  • sendResetPasswordEmail(tenantId: string, userId: string, userContext?: any): Promise<{ status: "OK" | "UNKNOWN_USER_ID_ERROR" }>
  • thirdPartyGetProvider(tenantId: string, thirdPartyId: string, clientType: undefined | string, userContext?: any): Promise<undefined | TypeProvider>
  • thirdPartyManuallyCreateOrUpdateUser(tenantId: string, thirdPartyId: string, thirdPartyUserId: string, email: string, userContext?: any): Promise<{ createdNewUser: boolean; status: "OK"; user: User }>
  • updateEmailOrPassword(input: { applyPasswordPolicy?: boolean; email?: string; password?: string; tenantIdForPasswordPolicy?: string; userContext?: any; userId: string }): Promise<{ status: "OK" | "EMAIL_ALREADY_EXISTS_ERROR" | "UNKNOWN_USER_ID_ERROR" } | { failureReason: string; status: "PASSWORD_POLICY_VIOLATED_ERROR" }>
  • Parameters

    • input: { applyPasswordPolicy?: boolean; email?: string; password?: string; tenantIdForPasswordPolicy?: string; userContext?: any; userId: string }
      • Optional applyPasswordPolicy?: boolean
      • Optional email?: string
      • Optional password?: string
      • Optional tenantIdForPasswordPolicy?: string
      • Optional userContext?: any
      • userId: string

    Returns Promise<{ status: "OK" | "EMAIL_ALREADY_EXISTS_ERROR" | "UNKNOWN_USER_ID_ERROR" } | { failureReason: string; status: "PASSWORD_POLICY_VIOLATED_ERROR" }>

Generated using TypeDoc