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 Object parameter. Expand to see child parameters.
Show child parameters Email address for the Linxio API or dashboard user.
Password for the user. Load this from a secret store or environment variable.
Optional tenant or hosted-domain hint. Most API integrations can omit it.
Returns Object field. Expand to see child fields.
Show child fields JWT bearer token used for authenticated API requests.
refreshTokenstring
optional Refresh token used by the SDK when a recoverable 401 response is received.
expireAtISODateString
optional Token expiry timestamp when supplied by Linxio.
otp_requiredboolean
optional True when the account must complete OTP before the session is usable.
Typed SDK error when login fails.
Show child fields Original cause when available.
HTTP method when the error came from a request.
API path when the error came from a request.
Request identifier from X-Request-Id when supplied.
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." );
} {
"data" : {
"token" : "jwt_token" ,
"refreshToken" : "refresh_token" ,
"expireAt" : "2026-06-08T12:00:00+08:00" ,
"otp_required" : true
} ,
"error" : null
}
Input Object parameter. Expand to see child parameters.
Show child parameters Email address used for the login attempt.
One-time password code supplied by Linxio.
Returns The same session shape returned by auth.login().
Show child fields expireAtISODateString
optional Token expiry timestamp when supplied.
loginWithIdboolean
optional Whether the login flow was resolved by identifier.
otp_requiredboolean
optional Whether OTP verification is required before the session is usable.
refreshTokenstring
optional Refresh token used to renew the session.
Role identifier when supplied.
teamTypeLinxioTeamType
optional Team type returned by Linxio.
Possible enum values
adminAdministrative team.
clientClient-account team.
resellerReseller-account team.
JWT bearer token for authenticated requests.
Typed SDK error when OTP verification fails.
Show child fields Original cause when available.
HTTP method when the error came from a request.
API path when the error came from a request.
Request identifier from X-Request-Id when supplied.
const verified = await linxio.auth. verifyOtp ({
email: process.env. LINXIO_EMAIL ! ,
code: oneTimeCode,
});
if (verified.error) {
throw verified.error;
} {
"data" : {
"expireAt" : "2026-06-08T12:00:00+08:00" ,
"loginWithId" : true ,
"otp_required" : true ,
"refreshToken" : "refresh_token" ,
"roleId" : 64553 ,
"teamType" : "string" ,
"token" : "jwt_token"
} ,
"error" : null
}
Input refreshTokenstring
required Refresh token returned by login or a previous refresh call.
Returns Updated in-memory token state containing token, refreshToken, and expireAt when available.
Show child fields expireAtISODateString
optional refreshTokenstring
optional Typed SDK error when refresh fails.
Show child fields Original cause when available.
HTTP method when the error came from a request.
API path when the error came from a request.
Request identifier from X-Request-Id when supplied.
const session = linxio. session ();
if (session.refreshToken) {
const refreshed = await linxio.auth. refresh (session.refreshToken);
if (refreshed.error) {
throw refreshed.error;
}
} {
"data" : {
"expireAt" : "2026-06-08T12:00:00+08:00" ,
"refreshToken" : "refresh_token" ,
"token" : "jwt_token"
} ,
"error" : null
}
Input Optional field projection mapped to fields[] query parameters.
Returns Current user profile, permissions, team information, and tenant-specific fields returned by Linxio.
Show child fields User date format when supplied.
Current user email address.
Current user display name.
permissionsstring[]
optional Permission keys when supplied.
teamTypeLinxioTeamType
optional Current team type.
Possible enum values
adminAdministrative team.
clientClient-account team.
resellerReseller-account team.
Typed SDK error when the user cannot be loaded.
Show child fields Original cause when available.
HTTP method when the error came from a request.
API path when the error came from a request.
Request identifier from X-Request-Id when supplied.
const me = await linxio.auth. me ([ "id" , "email" , "teamType" , "team" ]);
if (me.error) {
throw me.error;
}
console. log (me.data.email, me.data.teamType); {
"data" : {
"dateFormat" : "json" ,
"email" : "user@example.com" ,
"fullName" : "Example User" ,
"id" : 64553 ,
"permissions" : [
"string"
] ,
"team" : {
"id" : 5932 ,
"type" : "client" ,
"clientId" : 5598 ,
"resellerId" : null ,
"resellerName" : null ,
"clientName" : "EXAMPLE CLIENT"
} ,
"teamType" : "string"
} ,
"error" : null
}
Input logout() does not take parameters.
Returns Undefined when logout succeeds.
Typed SDK error when logout fails.
Show child fields Original cause when available.
HTTP method when the error came from a request.
API path when the error came from a request.
Request identifier from X-Request-Id when supplied.
const loggedOut = await linxio.auth. logout ();
if (loggedOut.error) {
throw loggedOut.error;
} {
"error" : null
}
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);