linxio-js

Authentication

Login, session hydration, token refresh, OTP, and safe credential handling.

POST

Login

/loginlinxio.auth.login(payload)

Authenticates an API user and stores the returned session in the client instance. Future SDK requests automatically include the bearer token.

Method parameters

string
required
Email address for the Linxio API or dashboard user.
string
required
Password for the user. Load it from a secret store or environment variable.
string
optional
Optional tenant or hosted-domain hint. Most API integrations can omit it.

Returns

object
optional
Object field. Expand to see child fields.
Show child fields
string
optional
JWT bearer token used for authenticated API requests.
string
optional
Refresh token used by the SDK when a request receives a recoverable 401 response.
string
optional
Token expiry timestamp returned by Linxio when available.
boolean
optional
Whether Linxio requires an OTP challenge before the session can be used.
optional
Typed SDK error. Null when authentication succeeds.
Show child fields
string
required
Safe error message.
string
required
SDK error class name.
unknown
optional
Original cause when available.
string
optional
HTTP method when the error came from a request.
string
optional
API path when the error came from a request.
string
optional
Request identifier from X-Request-Id when supplied.

Session Hydration

Hydrate a client

createClient(options)

Use this when you persist sessions yourself and want a new process to resume without calling auth.login() again. Pass previously stored tokens directly into createClient.

Options

string
optional
JWT bearer token to use for authenticated requests.
string
optional
Refresh token used for automatic token recovery on 401 responses.
number
optional
Per-request timeout in milliseconds.
Default: 30000
{ retries?: number; delayMs?: number }
optional
Retry policy for idempotent requests that fail with transient network or 5xx errors.

Automatic Refresh

When a request receives 401 and a refresh token is available, the SDK calls /token/refresh, updates the in-memory session, and retries the original request once. Concurrent refreshes are coalesced — several simultaneous 401 responses only trigger one refresh request.

Two-Factor Authentication

POST

Verify OTP

/login/otplinxio.auth.verifyOtp(payload)

Completes an OTP challenge for accounts where Linxio requires a one-time code after the initial login. Linxio's integration notes recommend disabling OTP for machine users to avoid this step.

Method parameters

string
required
Email address for the Linxio user completing the OTP challenge.
string
required
One-time code delivered by Linxio to the user's registered device.

Secrets

Do not commit credentials. Prefer environment variables, a secret manager, or your deployment platform's encrypted environment configuration.

Recommended credential pattern
const linxio = createClient();

await linxio.auth.login({
  email: process.env.LINXIO_EMAIL!,    // from env, not source
  password: process.env.LINXIO_PASSWORD!, // from env, not source
});

On this page