Auth
Auth protocol schemas
Authentication Service Protocol
Defines the standard API contracts for Identity, Session Management,
and Access Control.
Source: packages/spec/src/api/auth.zod.ts
import { AuthProvider, LoginRequestSchema, LoginType, RefreshTokenRequestSchema, RegisterRequestSchema, SessionSchema, SessionResponseSchema, SessionUserSchema, UserProfileResponseSchema } from '@objectstack/spec/api';
import type { AuthProvider, LoginRequest, LoginType, RefreshTokenRequest, RegisterRequest, Session, SessionResponse, SessionUser, UserProfileResponse } from '@objectstack/spec/api';
// Validate data
const result = AuthProvider.parse(data);
local
google
github
microsoft
ldap
saml
| Property | Type | Required | Description |
|---|
| type | Enum<'email' | 'username' | 'phone' | 'magic-link' | 'social'> | ✅ | Login method |
| email | string | optional | Required for email/magic-link |
| username | string | optional | Required for username login |
| password | string | optional | Required for password login |
| provider | string | optional | Required for social (google, github) |
| redirectTo | string | optional | Redirect URL after successful login |
email
username
phone
magic-link
social
| Property | Type | Required | Description |
|---|
| refreshToken | string | ✅ | Refresh token |
| Property | Type | Required | Description |
|---|
| email | string | ✅ | |
| password | string | ✅ | |
| name | string | ✅ | |
| image | string | optional | |
| Property | Type | Required | Description |
|---|
| id | string | ✅ | |
| expiresAt | string | ✅ | |
| token | string | optional | |
| ipAddress | string | optional | |
| userAgent | string | optional | |
| userId | string | ✅ | |
| Property | Type | Required | Description |
|---|
| success | boolean | ✅ | Operation success status |
| error | { code: Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | … +265 more>; message: string; category?: string; httpStatus?: integer; … } | optional | Error details if success is false |
| meta | { timestamp: string; duration?: number; requestId?: string; traceId?: string } | optional | Response metadata |
| data | { session: object; user: object; token?: string } | ✅ | |
| Property | Type | Required | Description |
|---|
| id | string | ✅ | User ID |
| email | string | ✅ | Email address |
| emailVerified | boolean | ✅ | Is email verified? |
| name | string | ✅ | Display name |
| image | string | optional | Avatar URL |
| username | string | optional | Username (optional) |
| roles | string[] | ✅ | Assigned role IDs |
| tenantId | string | optional | Current tenant ID |
| language | string | ✅ | Preferred language |
| timezone | string | optional | Preferred timezone |
| createdAt | string | optional | |
| updatedAt | string | optional | |
| Property | Type | Required | Description |
|---|
| success | boolean | ✅ | Operation success status |
| error | { code: Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | … +265 more>; message: string; category?: string; httpStatus?: integer; … } | optional | Error details if success is false |
| meta | { timestamp: string; duration?: number; requestId?: string; traceId?: string } | optional | Response metadata |
| data | { id: string; email: string; emailVerified: boolean; name: string; … } | ✅ | |