Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace authorization

Methods for API authorization management.

Index

Type aliases

interceptErrorProps: { onRemove?: any; onSet?: any }

Type declaration

interceptResponseProps: { onSet?: any }

Type declaration

Functions

  • interceptError(__namedParameters?: interceptErrorProps): (error: AxiosError<any, any>) => Promise<AxiosError<any, any>>
  • Removes the Authorization header if the response status code is 401, or if the Set-Authorization header is included in the error response, sets the header and user ID to device ID.

    Parameters

    Returns (error: AxiosError<any, any>) => Promise<AxiosError<any, any>>

      • (error: AxiosError<any, any>): Promise<AxiosError<any, any>>
      • Parameters

        • error: AxiosError<any, any>

        Returns Promise<AxiosError<any, any>>

  • interceptResponse(__namedParameters?: interceptResponseProps): (response: AxiosResponse<any, any>) => AxiosResponse<any, any>
  • If the Set-Authorization header is included in the response, sets the header and user ID to device ID.

    Parameters

    Returns (response: AxiosResponse<any, any>) => AxiosResponse<any, any>

      • (response: AxiosResponse<any, any>): AxiosResponse<any, any>
      • Parameters

        • response: AxiosResponse<any, any>

        Returns AxiosResponse<any, any>

  • removeHeader(): void
  • Removes the Authorization header from the API client (axios instance) and removes it from localStorage.

    Returns void

  • setHeader(authorizationHeader?: string): void
  • Sets the Authorization header on the API client (axios instance) and saves it within localStorage.

    Parameters

    • authorizationHeader: string = ...

    Returns void

Generated using TypeDoc