← All projects

js

Browser TypeScript client SDK for the aice-auth issuer, with login/refresh/logout and a pluggable token store.

  • TypeScript 97.72%
  • JavaScript 2.28%
git@gitlab.com:aice-lab/auth/js.git

Latest release

v1.0.0 ·

README

aice-auth — Browser JS / TypeScript SDK

pipeline status coverage report

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 (or null).
  • 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

CapabilityShipped
Password login (/auth/login)yes
Refresh-token rotation (/auth/refresh)yes
Logout (/auth/logout)yes
OIDC authorization-code flow with PKCEnot yet
Step-up flowsnot yet
Passkey assertion / TOTP / recovery codenot 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.