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

Module recipe/thirdpartyemailpassword

Index

References

EmailPasswordUserType

Renames and re-exports UserType

RecipeFunctionOptions

Re-exports RecipeFunctionOptions

ThirdPartyUserType

Re-exports ThirdPartyUserType

Type aliases

PostAPIHookContext

PostAPIHookContext: RecipePostAPIHookContext<PreAndPostAPIHookAction>

PreAPIHookContext

PreAPIHookContext: RecipePreAPIHookContext<PreAndPostAPIHookAction>

RecipeInterface

RecipeInterface: { doesEmailExist: any; emailPasswordSignIn: any; emailPasswordSignUp: any; generateStateToSendToOAuthProvider: any; getAuthCodeFromURL: any; getAuthErrorFromURL: any; getAuthStateFromURL: any; getAuthorisationURLFromBackend: any; getAuthorisationURLWithQueryParamsAndSetState: any; getResetPasswordTokenFromURL: any; getStateAndOtherInfoFromStorage: any; sendPasswordResetEmail: any; setStateAndOtherInfoToStorage: any; submitNewPassword: any; thirdPartySignInAndUp: any; verifyAndGetStateOrThrowError: any }

Type declaration

  • doesEmailExist:function
    • doesEmailExist(input: { email: string; options?: RecipeFunctionOptions; userContext: any }): Promise<{ doesExist: boolean; fetchResponse: Response; status: "OK" }>
  • emailPasswordSignIn:function
    • emailPasswordSignIn(input: { formFields: { id: string; value: string }[]; options?: RecipeFunctionOptions; userContext: any }): Promise<{ fetchResponse: Response; status: "OK"; user: UserType } | { fetchResponse: Response; formFields: { error: string; id: string }[]; status: "FIELD_ERROR" } | { fetchResponse: Response; status: "WRONG_CREDENTIALS_ERROR" }>
    • Sign in a user with email and password

      throws

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

      Parameters

      Returns Promise<{ fetchResponse: Response; status: "OK"; user: UserType } | { fetchResponse: Response; formFields: { error: string; id: string }[]; status: "FIELD_ERROR" } | { fetchResponse: Response; status: "WRONG_CREDENTIALS_ERROR" }>

      {status: "OK"} if successfull

  • emailPasswordSignUp:function
    • emailPasswordSignUp(input: { formFields: { id: string; value: string }[]; options?: RecipeFunctionOptions; userContext: any }): Promise<{ fetchResponse: Response; status: "OK"; user: UserType } | { fetchResponse: Response; formFields: { error: string; id: string }[]; status: "FIELD_ERROR" }>
    • Sign up a user with email and password

      throws

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

      Parameters

      Returns Promise<{ fetchResponse: Response; status: "OK"; user: UserType } | { fetchResponse: Response; formFields: { error: string; id: string }[]; status: "FIELD_ERROR" }>

      {status: "OK"} if successfull

  • generateStateToSendToOAuthProvider:function
    • generateStateToSendToOAuthProvider(input: { userContext: any }): string
  • getAuthCodeFromURL:function
    • getAuthCodeFromURL(input: { userContext: any }): string
    • Returns the auth code from the current URL

      Parameters

      • input: { userContext: any }
        • userContext: any

      Returns string

      The "code" query param from the current URL. Returns an empty string if no code exists

  • getAuthErrorFromURL:function
    • getAuthErrorFromURL(input: { userContext: any }): undefined | string
    • Returns the error from the current URL

      Parameters

      • input: { userContext: any }
        • userContext: any

      Returns undefined | string

      The "error" query param from the current URL. Returns undefined if no error exists

  • getAuthStateFromURL:function
    • getAuthStateFromURL(input: { userContext: any }): string
    • Returns the auth state from the current URL

      Parameters

      • input: { userContext: any }
        • userContext: any

      Returns string

      The "state" query param from the current URL. Returns an empty string if no state exists

  • getAuthorisationURLFromBackend:function
    • getAuthorisationURLFromBackend(input: { options?: RecipeFunctionOptions; providerId: string; userContext: any }): Promise<{ fetchResponse: Response; status: "OK"; url: string }>
  • getAuthorisationURLWithQueryParamsAndSetState:function
    • getAuthorisationURLWithQueryParamsAndSetState(input: { authorisationURL: string; options?: RecipeFunctionOptions; providerClientId?: string; providerId: string; userContext: any }): Promise<string>
  • getResetPasswordTokenFromURL:function
    • getResetPasswordTokenFromURL(input: { userContext: any }): string
  • getStateAndOtherInfoFromStorage:function
    • getStateAndOtherInfoFromStorage<CustomStateProperties>(input: { userContext: any }): undefined | (StateObject & CustomStateProperties)
    • Get the current login state from storage, this is also used when calling signInUp

      Type parameters

      • CustomStateProperties

      Parameters

      • input: { userContext: any }
        • userContext: any

      Returns undefined | (StateObject & CustomStateProperties)

      State object from storage

  • sendPasswordResetEmail:function
    • sendPasswordResetEmail(input: { formFields: { id: string; value: string }[]; options?: RecipeFunctionOptions; userContext: any }): Promise<{ fetchResponse: Response; status: "OK" } | { fetchResponse: Response; formFields: { error: string; id: string }[]; status: "FIELD_ERROR" }>
    • Send an email to the user for password reset

      throws

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

      Parameters

      Returns Promise<{ fetchResponse: Response; status: "OK" } | { fetchResponse: Response; formFields: { error: string; id: string }[]; status: "FIELD_ERROR" }>

      {status: "OK"} if successfull

  • setStateAndOtherInfoToStorage:function
    • setStateAndOtherInfoToStorage<CustomStateProperties>(input: { state: StateObject & CustomStateProperties; userContext: any }): Promise<void>
  • submitNewPassword:function
    • submitNewPassword(input: { formFields: { id: string; value: string }[]; options?: RecipeFunctionOptions; userContext: any }): Promise<{ fetchResponse: Response; status: "OK" | "RESET_PASSWORD_INVALID_TOKEN_ERROR" } | { fetchResponse: Response; formFields: { error: string; id: string }[]; status: "FIELD_ERROR" }>
    • Submit a new password for the user

      throws

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

      Parameters

      Returns Promise<{ fetchResponse: Response; status: "OK" | "RESET_PASSWORD_INVALID_TOKEN_ERROR" } | { fetchResponse: Response; formFields: { error: string; id: string }[]; status: "FIELD_ERROR" }>

      {status: "OK"} if successfull

  • thirdPartySignInAndUp:function
    • thirdPartySignInAndUp(input: { options?: RecipeFunctionOptions; userContext: any }): Promise<{ createdNewUser: boolean; fetchResponse: Response; status: "OK"; user: ThirdPartyUserType } | { fetchResponse: Response; status: "NO_EMAIL_GIVEN_BY_PROVIDER" }>
  • verifyAndGetStateOrThrowError:function
    • verifyAndGetStateOrThrowError<CustomStateProperties>(input: { stateFromAuthProvider: string | undefined; stateObjectFromStorage: (StateObject & CustomStateProperties) | undefined; userContext: any }): Promise<StateObject & CustomStateProperties>
    • Verify that the state recieved from the third party provider matches the one in storage

      Type parameters

      • CustomStateProperties

      Parameters

      • input: { stateFromAuthProvider: string | undefined; stateObjectFromStorage: (StateObject & CustomStateProperties) | undefined; userContext: any }
        • stateFromAuthProvider: string | undefined
        • stateObjectFromStorage: (StateObject & CustomStateProperties) | undefined
        • userContext: any

      Returns Promise<StateObject & CustomStateProperties>

UserInput

UserInput: { override?: { emailVerification?: EmailVerificationOverride; functions?: any } } & RecipeModuleUserInput<PreAndPostAPIHookAction>

Functions

Const doesEmailExist

  • doesEmailExist(input: { email: string; options?: RecipeFunctionOptions; userContext?: any }): Promise<{ doesExist: boolean; fetchResponse: Response; status: "OK" }>

Const emailPasswordSignIn

  • emailPasswordSignIn(input: { formFields: { id: string; value: string }[]; options?: RecipeFunctionOptions; userContext?: any }): Promise<{ fetchResponse: Response; status: "OK"; user: UserType } | { fetchResponse: Response; formFields: { error: string; id: string }[]; status: "FIELD_ERROR" } | { fetchResponse: Response; status: "WRONG_CREDENTIALS_ERROR" }>
  • Parameters

    • input: { formFields: { id: string; value: string }[]; options?: RecipeFunctionOptions; userContext?: any }
      • formFields: { id: string; value: string }[]
      • Optional options?: RecipeFunctionOptions
      • Optional userContext?: any

    Returns Promise<{ fetchResponse: Response; status: "OK"; user: UserType } | { fetchResponse: Response; formFields: { error: string; id: string }[]; status: "FIELD_ERROR" } | { fetchResponse: Response; status: "WRONG_CREDENTIALS_ERROR" }>

Const emailPasswordSignUp

  • emailPasswordSignUp(input: { formFields: { id: string; value: string }[]; options?: RecipeFunctionOptions; userContext?: any }): Promise<{ fetchResponse: Response; status: "OK"; user: UserType } | { fetchResponse: Response; formFields: { error: string; id: string }[]; status: "FIELD_ERROR" }>

Const generateStateToSendToOAuthProvider

  • generateStateToSendToOAuthProvider(input?: { userContext?: any }): string

Const getAuthCodeFromURL

  • getAuthCodeFromURL(input?: { userContext?: any }): string

Const getAuthErrorFromURL

  • getAuthErrorFromURL(input?: { userContext?: any }): undefined | string

Const getAuthStateFromURL

  • getAuthStateFromURL(input?: { userContext?: any }): string

Const getAuthorisationURLFromBackend

  • getAuthorisationURLFromBackend(input: { options?: RecipeFunctionOptions; providerId: string; userContext?: any }): Promise<{ fetchResponse: Response; status: "OK"; url: string }>

Const getAuthorisationURLWithQueryParamsAndSetState

  • getAuthorisationURLWithQueryParamsAndSetState(input: { authorisationURL: string; options?: RecipeFunctionOptions; providerClientId?: string; providerId: string; userContext?: any }): Promise<string>

Const getResetPasswordTokenFromURL

  • getResetPasswordTokenFromURL(input?: { userContext?: any }): string

Const getStateAndOtherInfoFromStorage

  • getStateAndOtherInfoFromStorage<CustomStateProperties>(input?: { userContext?: any }): undefined | (StateObject & CustomStateProperties)

Const init

  • init(config?: UserInput): CreateRecipeFunction<PreAndPostAPIHookAction>

Const isEmailVerified

  • isEmailVerified(input?: { options?: RecipeFunctionOptions; userContext?: any }): Promise<{ fetchResponse: Response; isVerified: boolean; status: "OK" }>

Const sendPasswordResetEmail

  • sendPasswordResetEmail(input: { formFields: { id: string; value: string }[]; options?: RecipeFunctionOptions; userContext?: any }): Promise<{ fetchResponse: Response; status: "OK" } | { fetchResponse: Response; formFields: { error: string; id: string }[]; status: "FIELD_ERROR" }>

Const sendVerificationEmail

  • sendVerificationEmail(input?: { options?: RecipeFunctionOptions; userContext?: any }): Promise<{ fetchResponse: Response; status: "OK" | "EMAIL_ALREADY_VERIFIED_ERROR" }>

Const setStateAndOtherInfoToStorage

  • setStateAndOtherInfoToStorage<CustomStateProperties>(input: { state: StateObject & CustomStateProperties; userContext?: any }): Promise<void>

Const signOut

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

Const submitNewPassword

  • submitNewPassword(input: { formFields: { id: string; value: string }[]; options?: RecipeFunctionOptions; userContext?: any }): Promise<{ fetchResponse: Response; status: "OK" | "RESET_PASSWORD_INVALID_TOKEN_ERROR" } | { fetchResponse: Response; formFields: { error: string; id: string }[]; status: "FIELD_ERROR" }>
  • Parameters

    • input: { formFields: { id: string; value: string }[]; options?: RecipeFunctionOptions; userContext?: any }
      • formFields: { id: string; value: string }[]
      • Optional options?: RecipeFunctionOptions
      • Optional userContext?: any

    Returns Promise<{ fetchResponse: Response; status: "OK" | "RESET_PASSWORD_INVALID_TOKEN_ERROR" } | { fetchResponse: Response; formFields: { error: string; id: string }[]; status: "FIELD_ERROR" }>

Const thirdPartySignInAndUp

  • thirdPartySignInAndUp(input?: { options?: RecipeFunctionOptions; userContext?: any }): Promise<{ createdNewUser: boolean; fetchResponse: Response; status: "OK"; user: ThirdPartyUserType } | { fetchResponse: Response; status: "NO_EMAIL_GIVEN_BY_PROVIDER" }>

Const verifyAndGetStateOrThrowError

  • verifyAndGetStateOrThrowError<CustomStateProperties>(input: { stateFromAuthProvider: undefined | string; stateObjectFromStorage: undefined | (StateObject & CustomStateProperties); userContext?: any }): Promise<StateObject & CustomStateProperties>
  • Type parameters

    • CustomStateProperties

    Parameters

    • input: { stateFromAuthProvider: undefined | string; stateObjectFromStorage: undefined | (StateObject & CustomStateProperties); userContext?: any }
      • stateFromAuthProvider: undefined | string
      • stateObjectFromStorage: undefined | (StateObject & CustomStateProperties)
      • Optional userContext?: any

    Returns Promise<StateObject & CustomStateProperties>

Const verifyEmail

  • verifyEmail(input?: { options?: RecipeFunctionOptions; userContext?: any }): Promise<{ fetchResponse: Response; status: "OK" | "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR" }>

Generated using TypeDoc