@krakentech/blueprint-auth
@krakentech/blueprint-auth is a comprehensive authentication library that
provides type-safe, production-ready authentication utilities for Next.js
applications integrating with the Kraken API. It supports both the Pages Router
and App Router patterns, offering flexible authentication flows including
email/password login, OAuth, masquerade mode, and anonymous access.
Key Features​
- Multiple Authentication Methods: Email/password, Kraken OAuth, staff masquerade, anonymous access, and organization-scoped authentication
- Router Agnostic: Full support for both Next.js Pages Router and App Router
- Unified Configuration: Single config object shared across client, server, and middleware
- Type-Safe: Built with TypeScript for comprehensive type safety across client and server
- GraphQL Integration: Authenticated GraphQL client utilities for seamless Kraken API integration
- Session Management: Secure cookie-based session handling with automatic token refresh
- Middleware Support: Route protection and authentication checks via Next.js middleware
Getting Started​
Choose your Next.js routing pattern to get started:
- Pages Router Setup - Set up
authentication with API routes and
getServerSideProps - App Router Setup - Set up authentication with Server Actions and Server Components
Documentation​
- API Reference - Complete API documentation for all exported functions and hooks
- Migration Guides - Upgrade guides for breaking changes and new versions
Authentication Guides​
- Internationalization (i18n) - Configure localized routing and authentication redirects for multilingual applications
- Kraken OAuth - OAuth integration with Kraken API
- Masquerade Mode - Staff impersonation for support scenarios
- Anonymous Authentication - Pre-signed key authentication for temporary, scoped access
- Organization Scoped Auth - Organization-level authentication flows
Tutorials​
- Building Forms (Pages Router) - Create authenticated forms with Pages Router (coming soon)
- Building Forms (App Router) - Create authenticated forms with App Router
Installation​
This package is published as a private npm package and requires an npm organisation access token:
- pnpm
- npm
- yarn
- bun
pnpm add @krakentech/blueprint-auth
npm install @krakentech/blueprint-auth
yarn add @krakentech/blueprint-auth
bun add @krakentech/blueprint-auth
Private package
Please get in touch if you need an npm organisation access token.