Introduction
KatanaID is a modern identity management platform designed to simplify authentication and user management for your applications.
This documentation will guide you through integrating KatanaID into your projects, from initial setup to advanced features.
This documentation is for KatanaID v0.7 Pre-release. For older versions, please refer to the version selector.
Installation
Install KatanaID using your preferred package manager:
npm install @katanaid/sdk
yarn add @katanaid/sdk
Quick Start
Get started with KatanaID in just a few lines of code:
import { KatanaID } from '@katanaid/sdk';
// Initialize the client
const katana = new KatanaID({
apiKey: 'your-api-key',
environment: 'production'
});
// Authenticate a user
const session = await katana.authenticate({
email: 'user@example.com',
password: 'secure-password'
});
Authentication
KatanaID supports multiple authentication methods to fit your application's needs:
Password Auth
Traditional email and password authentication with secure hashing.
OAuth / SSO
Integrate with Google, GitHub, and other OAuth providers.
Magic Links
Passwordless authentication via email magic links.
Passkeys
Modern WebAuthn-based passwordless authentication.
Identity Management
Manage user identities with a comprehensive set of tools for user profiles, roles, and permissions.
User Profiles
Access and update user profile information:
// Get current user
const user = await katana.getCurrentUser();
// Update profile
await katana.updateUser({
name: 'Jane Doe',
avatar: 'https://example.com/avatar.jpg'
});
Sessions
KatanaID provides secure session management with automatic token refresh and session invalidation.
Always store session tokens securely. Never expose them in client-side code or URLs.
API Overview
The KatanaID API follows REST conventions and returns JSON responses. All API requests require authentication via API key or session token.
Base URL
https://api.katanaid.com/v1
Endpoints
/auth/login
Authenticate a user and create a new session.
/users/me
Get the current authenticated user's profile.
/users/me
Update the current user's profile information.
/auth/session
Invalidate the current session (logout).
Error Handling
KatanaID uses conventional HTTP response codes to indicate the success or failure of API requests.
| Code | Description |
|---|---|
200 |
Success - Request completed successfully |
400 |
Bad Request - Invalid parameters |
401 |
Unauthorized - Invalid or missing authentication |
403 |
Forbidden - Insufficient permissions |
404 |
Not Found - Resource does not exist |
500 |
Server Error - Something went wrong on our end |