Options
All
  • Public
  • Public/Protected
  • All
Menu

Module recipe/passwordless

Index

References

Re-exports RecipeFunctionOptions

Type Aliases

PostAPIHookContext: RecipePostAPIHookContext<PreAndPostAPIHookAction>
PreAPIHookContext: RecipePreAPIHookContext<PreAndPostAPIHookAction>
PreAndPostAPIHookAction: "PASSWORDLESS_CREATE_CODE" | "PASSWORDLESS_CONSUME_CODE" | "PASSWORDLESS_RESEND_CODE" | "EMAIL_EXISTS" | "PHONE_NUMBER_EXISTS"
RecipeInterface: { clearLoginAttemptInfo: any; consumeCode: any; createCode: any; doesEmailExist: any; doesPhoneNumberExist: any; getLinkCodeFromURL: any; getLoginAttemptInfo: any; getPreAuthSessionIdFromURL: any; getTenantIdFromURL: any; resendCode: any; setLoginAttemptInfo: any }

Type declaration

  • clearLoginAttemptInfo:function
    • clearLoginAttemptInfo(input: { userContext: any }): Promise<void>
  • consumeCode:function
    • consumeCode(input: { deviceId: string; options?: RecipeFunctionOptions; preAuthSessionId: string; shouldTryLinkingWithSessionUser: boolean | undefined; tenantId: string | undefined; userContext: any; userInputCode: string } | { linkCode: string; options?: RecipeFunctionOptions; preAuthSessionId: string; shouldTryLinkingWithSessionUser: boolean | undefined; tenantId: string | undefined; userContext: any }): Promise<{ createdNewRecipeUser: boolean; fetchResponse: Response; status: "OK"; user: User } | { failedCodeInputAttemptCount: number; fetchResponse: Response; maximumCodeInputAttempts: number; status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR" } | { fetchResponse: Response; status: "RESTART_FLOW_ERROR" } | { fetchResponse: Response; reason: string; status: "SIGN_IN_UP_NOT_ALLOWED" }>
    • Log the user in using the input code or link code

      throws

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

      Parameters

      • input: { deviceId: string; options?: RecipeFunctionOptions; preAuthSessionId: string; shouldTryLinkingWithSessionUser: boolean | undefined; tenantId: string | undefined; userContext: any; userInputCode: string } | { linkCode: string; options?: RecipeFunctionOptions; preAuthSessionId: string; shouldTryLinkingWithSessionUser: boolean | undefined; tenantId: string | undefined; userContext: any }

      Returns Promise<{ createdNewRecipeUser: boolean; fetchResponse: Response; status: "OK"; user: User } | { failedCodeInputAttemptCount: number; fetchResponse: Response; maximumCodeInputAttempts: number; status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR" } | { fetchResponse: Response; status: "RESTART_FLOW_ERROR" } | { fetchResponse: Response; reason: string; status: "SIGN_IN_UP_NOT_ALLOWED" }>

      {status: "OK", user, createdNewRecipeUser: bool} if succesful

  • createCode:function
    • createCode(input: { email: string; options?: RecipeFunctionOptions; shouldTryLinkingWithSessionUser: boolean | undefined; userContext: any } | { options?: RecipeFunctionOptions; phoneNumber: string; shouldTryLinkingWithSessionUser: boolean | undefined; userContext: any }): Promise<{ deviceId: string; fetchResponse: Response; flowType: PasswordlessFlowType; preAuthSessionId: string; status: "OK" } | { fetchResponse: Response; reason: string; status: "SIGN_IN_UP_NOT_ALLOWED" }>
    • Create and send a code to the user for passwordless auth

      throws

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

      Parameters

      • input: { email: string; options?: RecipeFunctionOptions; shouldTryLinkingWithSessionUser: boolean | undefined; userContext: any } | { options?: RecipeFunctionOptions; phoneNumber: string; shouldTryLinkingWithSessionUser: boolean | undefined; userContext: any }

      Returns Promise<{ deviceId: string; fetchResponse: Response; flowType: PasswordlessFlowType; preAuthSessionId: string; status: "OK" } | { fetchResponse: Response; reason: string; status: "SIGN_IN_UP_NOT_ALLOWED" }>

      {status: "OK", deviceId, preAuthSessionId, flowType} If successful

  • doesEmailExist:function
    • doesEmailExist(input: { email: string; options?: RecipeFunctionOptions; userContext: any }): Promise<{ doesExist: boolean; fetchResponse: Response; status: "OK" }>
    • Check if a user with the given email exists

      throws

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

      Parameters

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

      {status: "OK", doesExist: boolean}

  • doesPhoneNumberExist:function
    • doesPhoneNumberExist(input: { options?: RecipeFunctionOptions; phoneNumber: string; userContext: any }): Promise<{ doesExist: boolean; fetchResponse: Response; status: "OK" }>
    • Check if a user with the given phone number exists

      throws

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

      Parameters

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

      {status: "OK", doesExist: boolean}

  • getLinkCodeFromURL:function
    • getLinkCodeFromURL(input: { userContext: any }): string
    • Reads and returns the link code from the current URL

      Parameters

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

      Returns string

      The hash (#) property of the current URL

  • getLoginAttemptInfo:function
    • getLoginAttemptInfo<CustomLoginAttemptInfoProperties>(input: { userContext: any }): Promise<undefined | { deviceId: string; flowType: PasswordlessFlowType; preAuthSessionId: string; shouldTryLinkingWithSessionUser?: boolean; tenantId?: string } & CustomLoginAttemptInfoProperties>
    • Get information about the current login attempt from storage

      Type Parameters

      • CustomLoginAttemptInfoProperties

      Parameters

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

      Returns Promise<undefined | { deviceId: string; flowType: PasswordlessFlowType; preAuthSessionId: string; shouldTryLinkingWithSessionUser?: boolean; tenantId?: string } & CustomLoginAttemptInfoProperties>

      {deviceId, preAuthSessionId, flowType} if present, returns undefined otherwise

  • getPreAuthSessionIdFromURL:function
    • getPreAuthSessionIdFromURL(input: { userContext: any }): string
    • Reads and returns the pre auth session id from the current URL

      Parameters

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

      Returns string

      The "preAuthSessionId" query parameter from the current URL

  • 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

  • resendCode:function
    • resendCode(input: { deviceId: string; options?: RecipeFunctionOptions; preAuthSessionId: string; shouldTryLinkingWithSessionUser: boolean | undefined; tenantId: string | undefined; userContext: any }): Promise<{ fetchResponse: Response; status: "OK" | "RESTART_FLOW_ERROR" }>
    • Resend the code to the user

      throws

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

      Parameters

      • input: { deviceId: string; options?: RecipeFunctionOptions; preAuthSessionId: string; shouldTryLinkingWithSessionUser: boolean | undefined; tenantId: string | undefined; userContext: any }
        • deviceId: string
        • Optional options?: RecipeFunctionOptions
        • preAuthSessionId: string
        • shouldTryLinkingWithSessionUser: boolean | undefined
        • tenantId: string | undefined
        • userContext: any

      Returns Promise<{ fetchResponse: Response; status: "OK" | "RESTART_FLOW_ERROR" }>

      {status: "OK"} if succesful

  • setLoginAttemptInfo:function
    • setLoginAttemptInfo<CustomStateProperties>(input: { attemptInfo: { deviceId: string; flowType: PasswordlessFlowType; preAuthSessionId: string; shouldTryLinkingWithSessionUser: boolean | undefined; tenantId?: string } & CustomStateProperties; userContext: any }): Promise<void>
    • Set information about the current login attempt to storage

      Type Parameters

      • CustomStateProperties

      Parameters

      • input: { attemptInfo: { deviceId: string; flowType: PasswordlessFlowType; preAuthSessionId: string; shouldTryLinkingWithSessionUser: boolean | undefined; tenantId?: string } & CustomStateProperties; userContext: any }
        • attemptInfo: { deviceId: string; flowType: PasswordlessFlowType; preAuthSessionId: string; shouldTryLinkingWithSessionUser: boolean | undefined; tenantId?: string } & CustomStateProperties
        • userContext: any

      Returns Promise<void>

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

Functions

  • clearLoginAttemptInfo(input?: { userContext?: any }): Promise<void>
  • consumeCode(input?: { options?: RecipeFunctionOptions; userContext?: any; userInputCode: string } | { options?: RecipeFunctionOptions; userContext?: any }): Promise<{ createdNewRecipeUser: boolean; fetchResponse: Response; status: "OK"; user: User } | { failedCodeInputAttemptCount: number; fetchResponse: Response; maximumCodeInputAttempts: number; status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR" } | { fetchResponse: Response; status: "RESTART_FLOW_ERROR" } | { fetchResponse: Response; reason: string; status: "SIGN_IN_UP_NOT_ALLOWED" }>
  • Parameters

    Returns Promise<{ createdNewRecipeUser: boolean; fetchResponse: Response; status: "OK"; user: User } | { failedCodeInputAttemptCount: number; fetchResponse: Response; maximumCodeInputAttempts: number; status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR" } | { fetchResponse: Response; status: "RESTART_FLOW_ERROR" } | { fetchResponse: Response; reason: string; status: "SIGN_IN_UP_NOT_ALLOWED" }>

  • createCode(input: { email: string; options?: RecipeFunctionOptions; shouldTryLinkingWithSessionUser?: boolean; userContext?: any } | { options?: RecipeFunctionOptions; phoneNumber: string; shouldTryLinkingWithSessionUser?: boolean; userContext?: any }): Promise<{ deviceId: string; fetchResponse: Response; flowType: PasswordlessFlowType; preAuthSessionId: string; status: "OK" } | { fetchResponse: Response; reason: string; status: "SIGN_IN_UP_NOT_ALLOWED" }>
  • Parameters

    • input: { email: string; options?: RecipeFunctionOptions; shouldTryLinkingWithSessionUser?: boolean; userContext?: any } | { options?: RecipeFunctionOptions; phoneNumber: string; shouldTryLinkingWithSessionUser?: boolean; userContext?: any }

    Returns Promise<{ deviceId: string; fetchResponse: Response; flowType: PasswordlessFlowType; preAuthSessionId: string; status: "OK" } | { fetchResponse: Response; reason: string; status: "SIGN_IN_UP_NOT_ALLOWED" }>

  • doesEmailExist(input: { email: string; options?: RecipeFunctionOptions; userContext?: any }): Promise<{ doesExist: boolean; fetchResponse: Response; status: "OK" }>
  • doesPhoneNumberExist(input: { options?: RecipeFunctionOptions; phoneNumber: string; userContext?: any }): Promise<{ doesExist: boolean; fetchResponse: Response; status: "OK" }>
  • getLinkCodeFromURL(input?: { userContext?: any }): string
  • getLoginAttemptInfo<CustomLoginAttemptInfoProperties>(input?: { userContext?: any }): Promise<undefined | { deviceId: string; flowType: PasswordlessFlowType; preAuthSessionId: string; shouldTryLinkingWithSessionUser?: boolean; tenantId?: string } & CustomLoginAttemptInfoProperties>
  • Type Parameters

    • CustomLoginAttemptInfoProperties

    Parameters

    • Optional input: { userContext?: any }
      • Optional userContext?: any

    Returns Promise<undefined | { deviceId: string; flowType: PasswordlessFlowType; preAuthSessionId: string; shouldTryLinkingWithSessionUser?: boolean; tenantId?: string } & CustomLoginAttemptInfoProperties>

  • getPreAuthSessionIdFromURL(input?: { userContext?: any }): string
  • getTenantIdFromURL(input?: { userContext?: any }): undefined | string
  • resendCode(input?: { options?: RecipeFunctionOptions; userContext?: any }): Promise<{ fetchResponse: Response; status: "OK" | "RESTART_FLOW_ERROR" }>
  • setLoginAttemptInfo<CustomStateProperties>(input: { attemptInfo: { deviceId: string; flowType: PasswordlessFlowType; preAuthSessionId: string; shouldTryLinkingWithSessionUser?: boolean } & CustomStateProperties; userContext?: any }): Promise<void>
  • Type Parameters

    • CustomStateProperties

    Parameters

    • input: { attemptInfo: { deviceId: string; flowType: PasswordlessFlowType; preAuthSessionId: string; shouldTryLinkingWithSessionUser?: boolean } & CustomStateProperties; userContext?: any }
      • attemptInfo: { deviceId: string; flowType: PasswordlessFlowType; preAuthSessionId: string; shouldTryLinkingWithSessionUser?: boolean } & CustomStateProperties
      • Optional userContext?: any

    Returns Promise<void>

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

Generated using TypeDoc