Registry / security / azuriom-auth

azuriom-auth

JSON →
library1.1.1jsnpmunverified

A JavaScript/TypeScript client library for the Azuriom Auth API, enabling user authentication (including 2FA) on Azuriom-powered game servers. Version 1.1.1 is current, requires Node >=18, and is actively maintained. Unlike generic OAuth libraries, this is purpose-built for Azuriom's API, providing a simple AuthClient class with login/verify/logout methods and full TypeScript support.

npm install azuriom-auth
INSTALL
IMPORT
SIG · AZURIOM-AUTH
A
azuriom-auth
securityjavascriptv1.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AuthClient
import { AuthClient } from 'azuriom-auth'
import AuthClient from 'azuriom-auth'
AuthClient is a named export, not a default export; the library is ESM-only.
AuthResult
import { AuthResult } from 'azuriom-auth'
const AuthResult = require('azuriom-auth').AuthResult
TypeScript type, but can also be imported as a value if needed.
type AuthClient
import type { AuthClient } from 'azuriom-auth'
import { AuthClient } from 'azuriom-auth'
Use type-only import for type-checking contexts to avoid runtime overhead.

Shows how to instantiate AuthClient, perform login with 2FA support, and handle the AuthResult.

import { AuthClient } from 'azuriom-auth'; const client = new AuthClient('https://your-azuriom-site.com'); async function loginUser(email: string, password: string) { let result = await client.login(email, password); if (result.status === 'pending' && result.requires2fa) { const twoFactorCode = '<2FA code>'; // Replace with actual code result = await client.login(email, password, twoFactorCode); } if (result.status !== 'success') { throw new Error('Login failed: ' + JSON.stringify(result)); } return result; }
Debug
Known issues
gotchaAll methods throw on network errors (e.g., fetch rejection). Always wrap calls in try/catch.
fix
Use try-catch blocks around all API calls.
affects: >=1.0.0
gotchaThe constructor expects a URL without trailing slash; including one may cause 404.
fix
Pass URL without trailing slash: new AuthClient('https://example.com')
affects: >=1.0.0
gotcha2FA flow: the second call to login() must include the same email/password plus the 2FA code. Do not reuse the initial result's accessToken.
fix
Always pass email and password again when providing 2FA code.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Cannot destructure property 'status' of 'result' as it is undefined.
The login call threw an error instead of returning a result, usually due to network failure or incorrect URL.
fix
Wrap the call in try/catch to handle network errors: try { const result = await client.login(...); } catch (e) { ... }
Error: 404 Not Found: /api/auth/login
The base URL provided to AuthClient has a trailing slash, causing incorrect API path.
fix
Remove trailing slash from URL passed to AuthClient constructor: new AuthClient('https://example.com')
TypeError: client.login is not a function
AuthClient was imported incorrectly (e.g., default import instead of named import), or the library was not installed.
fix
Ensure correct import: import { AuthClient } from 'azuriom-auth' and install the package.
Upgrade
Version history
1.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
17
Resources
azuriom-auth — npm install azuriom-auth · libregistry