Skip to content

v1.2 • Utils • 9kb gzipped • MIT

AuthKit

Drop-in JWT, OAuth and magic links with secure defaults and a five-minute setup.

★ 4.1kGitHub
↓ 22.2k / week● MIT● TS 5.0+
authkit-preview.png
Abstract preview graphic for AuthKit

// why authkit

Secure by default

Tokens are stored where they should be, refreshed before they expire and cleared on sign-out. You have to go out of your way to make it unsafe.

● 0 deps● 9kb gzipped● tree-shakeable

// stack

Provider agnostic

The same API covers your own backend, a hosted identity provider or both at once during a migration.

AuthKit started as a single file in a client project and stayed small on purpose. It does one job, it does it in 9kb gzipped, and it has no runtime dependencies.

Getting started

Install it, import it, call it:

npm i authkit-js

Tokens are stored where they should be, refreshed before they expire and cleared on sign-out. You have to go out of your way to make it unsafe.

What it does not do

It does not manage your state, style your components or ship a plugin system. Those are your decisions, and keeping them out is what keeps the bundle honest.

  • Silent refresh
  • Multi-tab sign-out
  • MIT licensed, commercially friendly

Features

Silent refresh

Renews a token before expiry and holds pending requests until it lands, so a session never blinks.

Multi-tab sign-out

Signing out in one tab signs out the rest through a broadcast channel.

ESM and types

Ships module and CommonJS builds with hand-written type definitions and source maps.

Tree-shakes cleanly

Every export is side-effect free, so importing one function costs one function.

Tested to the edges

Ninety-eight percent branch coverage, with the awkward cases written first.

Node and browser

One build runs in both, with no conditional exports to get wrong.

Get AuthKit v1.2

9 files • .min.js 9kb • .zip 39kb • sha384 verified

Changelog

v1.2 Jul 17 2026 • latest
  • Silent refresh with request queueing
  • Multi-tab sign-out synchronisation
  • PKCE flow enabled by default
v1.1.1 Apr 12 2026
  • Fixed a memory leak on repeated teardown
  • Source maps now published with every build
v1.1 Feb 8 2026
  • Type definitions rewritten by hand
  • Dropped the last runtime dependency
View full archive →

// related

Related products

Sep 10 • v2.0

ChartForge

Canvas charts in twelve lines. Responsive, accessible and dark-mode ready, with no D3 learning curve.

View →
Aug 30 • v3.2.1

MotionEase

Physics-based micro-animations with a single call. Spring curves that feel right without a tuning session.

View →
Aug 19 • v1.9.4

FormFlow

Validation and multi-step logic that works the same in React, Vue and vanilla. Your markup stays yours.

View →

Drop it in this afternoon.

MIT licensed. Commercial friendly. Five-minute setup.