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, LoginRequest, LoginType, RefreshTokenRequest, RegisterRequest, SessionResponse, SessionUser, UserProfileResponse } from '@objectstack/spec/api';
import type { AuthProvider, LoginRequest, LoginType, RefreshTokenRequest, RegisterRequest, 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 |
|---|
| success | boolean | ✅ | Operation success status |
| error | Object | optional | Error details if success is false |
| meta | Object | optional | Response metadata |
| data | Object | ✅ | |
| 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 | Object | optional | Error details if success is false |
| meta | Object | optional | Response metadata |
| data | Object | ✅ | |