Skip to main content

getAuthHTTPClient()

function getAuthHTTPClient(config?: {
baseURL?: string;
headers?: RequestConfig;
rest?: any[];
sendLogRocketSessionHeader?: boolean;
}): AxiosInstance;

Creates an authenticated HTTP client instance with authorization headers. Automatically includes the current user's authorization token in all requests.

Parameters

config?

Configuration options

baseURL?

string

Base URL for API requests (defaults to app config value)

headers?

RequestConfig = {}

Custom headers to include in requests

rest?

any[]

sendLogRocketSessionHeader?

boolean = false

Include LogRocket session URL in headers

Returns

AxiosInstance

Configured Axios instance with auth headers

Example

const client = getAuthHTTPClient();
const response = await client.get('/secure/endpoint');