Skip to main content

Admin Auth — TypeScript SDK

Admin-scope authentication and the currently-logged-in admin's identity.

Overview​

AdminClient is a separate client for admin-scope operations (billing read + customer CRUD). It authenticates with an admin username and password (no captcha, no API key) and issues a session token scoped to admin-only endpoints. Use WltClient for tenant-user operations and AdminClient when the caller must act as an administrator.

The Auth resource exposes a single endpoint returning the currently logged-in admin's profile, including the admin's user type (e.g. partner_admin) and tenant context.

Accessed via admin.auth.

Available Operations​

MethodDescription
info()Get the current logged-in admin's information

Client construction​

Instantiate AdminClient with the admin's username and password. The SDK exchanges them for a short-lived session token on the first request and refreshes it transparently on expiry.

import { AdminClient } from 'wlt-platform';

const admin = new AdminClient({
username: 'admin',
password: 'your-admin-password',
baseUrl: 'https://console.example.com',
timeout: 30_000,
maxRetries: 2,
});
OptionTypeRequiredDefaultDescription
usernamestringYes--Admin username
passwordstringYes--Admin password (no captcha)
baseUrlstringNoBuilt-in defaultConsole base URL. See resolution rules on the Overview page.
timeoutnumberNo30000Request timeout in milliseconds
maxRetriesnumberNo2Max retry attempts

info​

Get the current logged-in admin's full profile.

Example Usage​

import { AdminClient } from 'wlt-platform';

const admin = new AdminClient({ username: 'admin', password: 'your-admin-password',
baseUrl: 'https://console.example.com' });

const info = await admin.auth.info();
console.log(`userId=${info.userId} userName=${info.userName} userType=${info.userType}`);

Parameters​

None.

Response​

Returns an object with the admin's profile. Key fields:

FieldTypeDescription
userIdnumberAdmin user ID
userNamestringAdmin username
userTypestringAdmin type (e.g. partner_admin, sys_admin)
accountStructurenumberAccount structure code
partnerIdnumberTenant ID this admin belongs to
partnerNamestringTenant name
parentUserIdnumberParent user ID
timezonestringTimezone (e.g. Europe/Paris)
regionstringRegion (e.g. ap-southeast-1)
userPermissionobjectAdmin permission metadata

Admin resources return raw payloads directly (not a wrapper). Read fields with info.field.

Errors​

CodeExceptionWhen
500AuthenticationErrorUsername or password incorrect
2007PermissionErrorNot an admin account
3001AuthenticationErrorSession expired and refresh failed
3002AuthenticationErrorLogin attempts rate-limited (retry after 15-60 s)