SDK Reference
Authentication Login, OTP, token refresh, current user, logout, and session hydration methods.
Use the auth service to create and maintain a Linxio session. Successful
login, verifyOtp, and refresh calls update the client instance in memory,
so later service calls send the bearer token automatically.
Input request.emailstring
required Email address for the Linxio API or dashboard user.
request.passwordstring
required Password for the user. Load this from a secret store or environment variable.
request.domainstring
optional Optional tenant or hosted-domain hint. Most API integrations can omit it.
Returns JWT bearer token used for authenticated API requests.
data.refreshTokenstring
optional Refresh token used by the SDK when a recoverable 401 response is received.
data.expireAtISODateString
optional Token expiry timestamp when supplied by Linxio.
data.otp_requiredboolean
optional True when the account must complete OTP before the session is usable.
errorLinxioError | null
optional Typed SDK error when login fails.
const login = await linxio.auth. login ({
email: process.env. LINXIO_EMAIL ! ,
password: process.env. LINXIO_PASSWORD ! ,
});
if (login.error) {
throw login.error;
}
if (login.data.otp_required) {
console. log ( "Complete OTP before using the session." );
}
Input request.emailstring
required Email address used for the login attempt.
request.codestring
required One-time password code supplied by Linxio.
Returns dataLinxioLoginResponse
optional The same session shape returned by auth.login().
errorLinxioError | null
optional Typed SDK error when OTP verification fails.
const verified = await linxio.auth. verifyOtp ({
email: process.env. LINXIO_EMAIL ! ,
code: oneTimeCode,
});
if (verified.error) {
throw verified.error;
}
Input refreshTokenstring
required Refresh token returned by login or a previous refresh call.
Returns dataLinxioSession
optional Updated in-memory token state containing token, refreshToken, and expireAt when available.
errorLinxioError | null
optional Typed SDK error when refresh fails.
const session = linxio. session ();
if (session.refreshToken) {
const refreshed = await linxio.auth. refresh (session.refreshToken);
if (refreshed.error) {
throw refreshed.error;
}
}
Input Optional field projection mapped to fields[] query parameters.
Returns dataLinxioCurrentUser
optional Current user profile, permissions, team information, and tenant-specific fields returned by Linxio.
errorLinxioError | null
optional Typed SDK error when the user cannot be loaded.
const me = await linxio.auth. me ([ "id" , "email" , "teamType" , "team" ]);
if (me.error) {
throw me.error;
}
console. log (me.data.email, me.data.teamType);
Input logout() does not take parameters.
Returns Undefined when logout succeeds.
errorLinxioError | null
optional Typed SDK error when logout fails.
const loggedOut = await linxio.auth. logout ();
if (loggedOut.error) {
throw loggedOut.error;
}
LinxioSession refreshTokenstring
optional Refresh token used for automatic token refresh.
expireAtISODateString
optional Token expiry timestamp when supplied by Linxio.
const savedSession = linxio. session ();
await saveEncryptedSession (savedSession);
const restored = await loadEncryptedSession ();
linxio. setSession (restored);