Options
All
  • Public
  • Public/Protected
  • All
Menu

Module recipe/thirdpartyemailpassword

Index

References

Re-exports ActiveDirectory
Re-exports Apple
Re-exports Bitbucket
Re-exports BoxySAML
Re-exports Discord
Re-exports Facebook
Re-exports Github
Re-exports Gitlab
Re-exports Google
Re-exports GoogleWorkspaces
Re-exports LinkedIn
Re-exports Okta
Re-exports Twitter

Type Aliases

RecipeInterface: { doesEmailExist: any; emailPasswordSignIn: any; emailPasswordSignUp: any; generateStateToSendToOAuthProvider: any; getAuthErrorFromURL: any; getAuthStateFromURL: any; getAuthorisationURLFromBackend: any; getAuthorisationURLWithQueryParamsAndSetState: any; getResetPasswordTokenFromURL: any; getStateAndOtherInfoFromStorage: any; getTenantIdFromURL: 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" }>
    • Check if an email exists

      throws

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

      Parameters

      • input: { email: string; options?: RecipeFunctionOptions; userContext: any }
        • email: string
        • Optional options?: RecipeFunctionOptions
        • userContext: any

      Returns Promise<{ doesExist: boolean; fetchResponse: Response; status: "OK" }>

      {status: "OK", doesExist: boolean}

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

      throws

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

      Parameters

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

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

      {status: "OK"} if successfull

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

      throws

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

      Parameters

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

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

      {status: "OK"} if successfull

  • generateStateToSendToOAuthProvider:function
    • generateStateToSendToOAuthProvider(input?: { frontendRedirectURI?: string; userContext: any }): string
    • Generate a new state that will be sent to the thirs party provider

      Parameters

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

      Returns string

      string

  • 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; redirectURIOnProviderDashboard: string; tenantId: string | undefined; thirdPartyId: string; userContext: any }): Promise<{ fetchResponse: Response; pkceCodeVerifier?: string; status: "OK"; urlWithQueryParams: string }>
    • Get the URL to be used by the third party provider for redirecting after the auth flow. Also returns PKCE Code Verifier if using PKCE.

      throws

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

      Parameters

      • input: { options?: RecipeFunctionOptions; redirectURIOnProviderDashboard: string; tenantId: string | undefined; thirdPartyId: string; userContext: any }
        • Optional options?: RecipeFunctionOptions
        • redirectURIOnProviderDashboard: string
        • tenantId: string | undefined
        • thirdPartyId: string
        • userContext: any

      Returns Promise<{ fetchResponse: Response; pkceCodeVerifier?: string; status: "OK"; urlWithQueryParams: string }>

      {status: "OK", url, pkceCodeVerifier?}

  • getAuthorisationURLWithQueryParamsAndSetState:function
    • getAuthorisationURLWithQueryParamsAndSetState(input: { frontendRedirectURI: string; options?: RecipeFunctionOptions; redirectURIOnProviderDashboard?: string; tenantId: string | undefined; thirdPartyId: string; userContext: any }): Promise<string>
    • Get the URL that should be opened for third party authentication

      Parameters

      • input: { frontendRedirectURI: string; options?: RecipeFunctionOptions; redirectURIOnProviderDashboard?: string; tenantId: string | undefined; thirdPartyId: string; userContext: any }
        • frontendRedirectURI: string
        • Optional options?: RecipeFunctionOptions
        • Optional redirectURIOnProviderDashboard?: string
        • tenantId: string | undefined
        • thirdPartyId: string
        • userContext: any

      Returns Promise<string>

      URL string

  • getResetPasswordTokenFromURL:function
    • getResetPasswordTokenFromURL(input: { userContext: any }): string
    • Reads and returns the reset password token from the current URL

      Parameters

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

      Returns string

      The "token" query parameter from the current location

  • 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

  • getTenantIdFromURL:function
    • getTenantIdFromURL(input: { userContext: any }): undefined | string
    • Reads and returns the tenant id from the current URL

      Parameters

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

      Returns undefined | string

      The "tenantId" query parameter from the current URL

  • sendPasswordResetEmail:function
    • sendPasswordResetEmail(input: { formFields: { id: string; value: string }[]; options?: RecipeFunctionOptions; userContext: any }): Promise<{ fetchResponse: Response; status: "OK" } | { fetchResponse: Response; reason: string; status: "PASSWORD_RESET_NOT_ALLOWED" } | { 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

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

      Returns Promise<{ fetchResponse: Response; status: "OK" } | { fetchResponse: Response; reason: string; status: "PASSWORD_RESET_NOT_ALLOWED" } | { 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>
    • Set the login state to storage

      Type Parameters

      • CustomStateProperties

      Parameters

      • input: { state: StateObject & CustomStateProperties; userContext: any }
        • state: StateObject & CustomStateProperties
        • userContext: any

      Returns Promise<void>

  • submitNewPassword:function
    • submitNewPassword(input: { formFields: { id: string; value: string }[]; options?: RecipeFunctionOptions; userContext: any }): Promise<{ fetchResponse: Response; status: "OK" } | { fetchResponse: Response; status: "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

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

      Returns Promise<{ fetchResponse: Response; status: "OK" } | { fetchResponse: Response; status: "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<{ createdNewRecipeUser: boolean; fetchResponse: Response; status: "OK"; tenantId?: string; user: User } | { fetchResponse: Response; status: "NO_EMAIL_GIVEN_BY_PROVIDER" } | { fetchResponse: Response; reason: string; status: "SIGN_IN_UP_NOT_ALLOWED" }>
    • Sign up/Sign in the user, this method uses the login attempt information from storage

      throws

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

      Parameters

      • input: { options?: RecipeFunctionOptions; userContext: any }
        • Optional options?: RecipeFunctionOptions
        • userContext: any

      Returns Promise<{ createdNewRecipeUser: boolean; fetchResponse: Response; status: "OK"; tenantId?: string; user: User } | { fetchResponse: Response; status: "NO_EMAIL_GIVEN_BY_PROVIDER" } | { fetchResponse: Response; reason: string; status: "SIGN_IN_UP_NOT_ALLOWED" }>

      {status: OK, user, createdNewRecipeUser: boolean} if succesful

  • 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: { disableEmailPassword?: boolean; oAuthCallbackScreen?: FeatureBaseConfig; override?: { functions?: any }; resetPasswordUsingTokenFeature?: ResetPasswordUsingTokenUserInput; signInAndUpFeature?: SignInAndUpFeatureUserInput } & AuthRecipeModuleUserInput<GetRedirectionURLContext, PreAndPostAPIHookAction, OnHandleEventContext>

Variables

ThirdpartyEmailPasswordComponentsOverrideProvider: FC<PropsWithChildren<{ components: ComponentOverrideMap }>> = Wrapper.ComponentsOverrideProvider

Functions

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

    • input: { email: string; options?: RecipeFunctionOptions; userContext?: UserContext }
      • email: string
      • Optional options?: RecipeFunctionOptions
      • Optional userContext?: UserContext

    Returns Promise<{ doesExist: boolean; fetchResponse: Response; status: "OK" }>

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

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

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

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

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

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

  • getAuthorisationURLWithQueryParamsAndSetState(input: { frontendRedirectURI: string; options?: RecipeFunctionOptions; redirectURIOnProviderDashboard?: string; thirdPartyId: string; userContext?: UserContext }): Promise<string>
  • Parameters

    • input: { frontendRedirectURI: string; options?: RecipeFunctionOptions; redirectURIOnProviderDashboard?: string; thirdPartyId: string; userContext?: UserContext }
      • frontendRedirectURI: string
      • Optional options?: RecipeFunctionOptions
      • Optional redirectURIOnProviderDashboard?: string
      • thirdPartyId: string
      • Optional userContext?: UserContext

    Returns Promise<string>

  • getResetPasswordTokenFromURL(input?: { userContext?: UserContext }): string
  • getStateAndOtherInfoFromStorage<CustomStateProperties>(input?: { userContext?: UserContext }): undefined | StateObject & CustomStateProperties
  • redirectToThirdPartyLogin(input: { thirdPartyId: string; userContext?: UserContext }): Promise<{ status: "OK" | "ERROR" }>
  • sendPasswordResetEmail(input: { formFields: { id: string; value: string }[]; options?: RecipeFunctionOptions; userContext?: UserContext }): Promise<{ fetchResponse: Response; status: "OK" | "PASSWORD_RESET_NOT_ALLOWED" } | { fetchResponse: Response; formFields: { error: string; id: string }[]; status: "FIELD_ERROR" }>
  • Parameters

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

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

  • signOut(input?: { userContext?: UserContext }): Promise<void>
  • submitNewPassword(input: { formFields: { id: string; value: string }[]; options?: RecipeFunctionOptions; userContext?: UserContext }): Promise<{ fetchResponse: Response; status: "OK" } | { fetchResponse: Response; status: "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?: UserContext }
      • formFields: { id: string; value: string }[]
      • Optional options?: RecipeFunctionOptions
      • Optional userContext?: UserContext

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

  • thirdPartySignInAndUp(input?: { options?: RecipeFunctionOptions; userContext?: UserContext }): Promise<{ createdNewRecipeUser: boolean; fetchResponse: Response; status: "OK"; user: User } | { fetchResponse: Response; status: "NO_EMAIL_GIVEN_BY_PROVIDER" } | { fetchResponse: Response; reason: string; status: "SIGN_IN_UP_NOT_ALLOWED" }>
  • Parameters

    • Optional input: { options?: RecipeFunctionOptions; userContext?: UserContext }
      • Optional options?: RecipeFunctionOptions
      • Optional userContext?: UserContext

    Returns Promise<{ createdNewRecipeUser: boolean; fetchResponse: Response; status: "OK"; user: User } | { fetchResponse: Response; status: "NO_EMAIL_GIVEN_BY_PROVIDER" } | { fetchResponse: Response; reason: string; status: "SIGN_IN_UP_NOT_ALLOWED" }>

Generated using TypeDoc