Added
Multi-Strategy Auth for Express SDK
8 days ago by Jim Verducci
π£ Wristband Express Auth SDK 6.0.0 Release π
Release v6.0.0
Breaking Changes
Migration Guide: https://github.com/wristband-dev/express-auth/blob/main/migration/v6/README.md
π Authentication Middleware API Changes
The createRequireSessionAuth() method has been replaced with createAuthMiddleware() to support multiple authentication strategies.
Migration:
createRequireSessionAuth()βcreateAuthMiddleware()- Must explicitly specify
authStrategies: ['SESSION'] sessionOptionsmust now be provided insessionConfig- CSRF configuration now only in a single location ->
sessionConfig.sessionOptions
π Tenant Parameter Standardization
Query Parameters:
tenant_domainβtenant_name
URL Placeholders:
{tenant_domain}β{tenant_name}({tenant_domain}is deprecated but still supported for backward compatibility)
π§ Type System Improvements
CallbackResultType:
- Enum replaced with string literal union type (
'completed'|'redirect_required') - No need to import
CallbackResultTypeenum anymore
AuthMiddlewareConfig:
- New nested configuration structure with
authStrategies,sessionConfig, andjwtConfig enableCsrfProtectionmoved tosessionConfig.sessionOptions
New Features
β¨ Multi-Strategy Authentication Middleware
New createAuthMiddleware() supports multiple authentication strategies with fallback behavior.
Supported Strategies:
SESSION- Cookie-based session authentication with automatic token refreshJWT- Bearer token authentication with JWKS validation
Features:
- Try multiple strategies in order until one succeeds
- Automatic access token refresh for expired tokens (SESSION strategy)
- Optional CSRF token validation (SESSION strategy)
- Rolling session windows (SESSION strategy)
- Configurable JWKS caching (JWT strategy)
π JWT Authentication Strategy
New JWT bearer token authentication powered by @wristband/typescript-jwt.
Features:
- Stateless JWT validation with JWKS
- Configurable JWK cache size and TTL
- Decoded JWT payload available in
req.auth - TypeScript support with Express Request augmentation
π Callback Failure Reasons
CallbackResult now includes a reason field when type === 'redirect_required':
missing_login_state- Login state cookie not foundinvalid_login_state- Login state validation failedlogin_required- Wristband returned login_required errorinvalid_grant- Authorization code was invalid or expired
For full documentation, see the README.