Reference / @getenginex/sdk / createEnginexClient
createEnginexClient()
createEnginexClient(
options?):EnginexClient
Creates the SDK client. It never throws for missing configuration: baseUrl/tenantHost/fetch are only resolved (and memoized) on the first request, so it is safe to create a client in a top-level module and import it during SSR (Next.js, Nuxt), even before location exists. If the configuration is incomplete, the first request rejects with an EnginexErrorCONFIGURATION_ERROR without calling fetch — see Next.js / SSR and Tenant and domains. It only throws for invalid or contradictory options (see @throws).
Parameters
options?
EnginexClientOptions = {}
Returns
Example
import { createEnginexClient, localStorageTokenStore } from '@getenginex/sdk'
export const enginex = createEnginexClient({
locale: 'pt-BR',
tokenStore: localStorageTokenStore(),
})Throws
CONFIGURATION_ERROR with a baseUrl that is not just the origin (path, query, fragment or credentials), with sessionOwner: 'app' and autoRefresh: true, or with onAccessTokenRejected without sessionOwner: 'app'.