Options
All
  • Public
  • Public/Protected
  • All
Menu

Module recipe/thirdparty

Index

Type Aliases

PostAPIHookContext: RecipePostAPIHookContext<PreAndPostAPIHookAction>
PreAPIHookContext: RecipePreAPIHookContext<PreAndPostAPIHookAction>
PreAndPostAPIHookAction: "GET_AUTHORISATION_URL" | "THIRD_PARTY_SIGN_IN_UP"
RecipeInterface: { generateStateToSendToOAuthProvider: any; getAuthErrorFromURL: any; getAuthStateFromURL: any; getAuthorisationURLFromBackend: any; getAuthorisationURLWithQueryParamsAndSetState: any; getStateAndOtherInfoFromStorage: any; setStateAndOtherInfoToStorage: any; signInAndUp: any; verifyAndGetStateOrThrowError: any }

Type declaration

  • generateStateToSendToOAuthProvider:function
    • generateStateToSendToOAuthProvider(input?: { frontendRedirectURI?: string; userContext: any }): string
    • Generate a new state that will be sent to the third 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

      throws

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

      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

  • 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

  • setStateAndOtherInfoToStorage:function
    • setStateAndOtherInfoToStorage<CustomStateProperties>(input: { state: StateObject & CustomStateProperties; userContext: any }): Promise<void>
  • signInAndUp:function
    • signInAndUp(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

      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>

StateObject: { expiresAt: number; pkceCodeVerifier?: string; redirectURIOnProviderDashboard: string; stateForAuthProvider: string; tenantId?: string; thirdPartyId: string }

Type declaration

  • expiresAt: number
  • Optional pkceCodeVerifier?: string
  • redirectURIOnProviderDashboard: string
  • stateForAuthProvider: string
  • Optional tenantId?: string
  • thirdPartyId: string
UserInput: { override?: { functions?: any } } & RecipeModuleUserInput<PreAndPostAPIHookAction>

Functions

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

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

    Returns Promise<string>

  • getStateAndOtherInfoFromStorage<CustomStateProperties>(input?: { userContext?: any }): undefined | StateObject & CustomStateProperties
  • signInAndUp(input?: { options?: RecipeFunctionOptions; userContext?: any }): 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

    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" }>

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

Generated using TypeDoc