js
Browser TypeScript client SDK for the aice-auth issuer, with login/refresh/logout and a pluggable token store.
git@gitlab.com:aice-lab/auth/js.git
Latest release
v1.0.0 ·
README
aice-auth — Browser JS / TypeScript SDK
Browser TypeScript client SDK for the aice-auth specification. Talks to an aice-auth issuer’s /auth/login, /auth/refresh, and /auth/logout endpoints, and persists the resulting token bundle in browser storage.
This package is published to npm as @aice-lab/auth-js.
Install
npm install @aice-lab/auth-js
The package targets modern evergreen browsers (last two versions of Chrome, Firefox, Safari, and Edge). It uses the platform fetch and sessionStorage APIs directly — no runtime dependencies.
Quickstart
import { AiceAuthClient } from '@aice-lab/auth-js';
const client = new AiceAuthClient({ issuerBaseUrl: 'https://id.example.com' });
const tokens = await client.login({
handleType: 'email',
handle: 'alice@example.org',
credential: 'correct-horse-battery-staple',
});
console.log(tokens.access_token);
After login succeeds, the client persists the token bundle in sessionStorage and exposes:
client.getAccessToken()— current access token (ornull).client.refresh()— rotate the refresh token and replace the stored bundle.client.logout()— call the issuer’s logout endpoint and clear storage.
If sessionStorage is unavailable (for example, during server-side rendering), the client transparently falls back to an in-memory store so construction never throws.
Status
| Capability | Shipped |
|---|---|
Password login (/auth/login) | yes |
Refresh-token rotation (/auth/refresh) | yes |
Logout (/auth/logout) | yes |
| OIDC authorization-code flow with PKCE | not yet |
| Step-up flows | not yet |
| Passkey assertion / TOTP / recovery code | not yet |
The rest of the surface lands as the spec’s conformance categories are wired up.
License
Source: FSL-1.1-Apache-2.0 (see LICENSE and LICENSE.FAQ.md).
Documentation
Full documentation: https://auth.aice-lab.org
Contributing
See CONTRIBUTING.md. All commits require DCO sign-off.
Reporting security issues
See SECURITY.md. Do not open public issues for vulnerabilities.
This is a snapshot generated from GitLab. For the live README, see the project page.