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
| Method | Description |
|---|---|
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,
});
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
| username | string | Yes | -- | Admin username |
| password | string | Yes | -- | Admin password (no captcha) |
| baseUrl | string | No | Built-in default | Console base URL. See resolution rules on the Overview page. |
| timeout | number | No | 30000 | Request timeout in milliseconds |
| maxRetries | number | No | 2 | Max 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:
| Field | Type | Description |
|---|---|---|
userId | number | Admin user ID |
userName | string | Admin username |
userType | string | Admin type (e.g. partner_admin, sys_admin) |
accountStructure | number | Account structure code |
partnerId | number | Tenant ID this admin belongs to |
partnerName | string | Tenant name |
parentUserId | number | Parent user ID |
timezone | string | Timezone (e.g. Europe/Paris) |
region | string | Region (e.g. ap-southeast-1) |
userPermission | object | Admin permission metadata |
Admin resources return raw payloads directly (not a wrapper). Read fields with
info.field.
Errors
| Code | Exception | When |
|---|---|---|
500 | AuthenticationError | Username or password incorrect |
2007 | PermissionError | Not an admin account |
3001 | AuthenticationError | Session expired and refresh failed |
3002 | AuthenticationError | Login attempts rate-limited (retry after 15-60 s) |