ObjectStackObjectStack

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

TypeScript Usage

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);

AuthProvider

Allowed Values

  • local
  • google
  • github
  • microsoft
  • ldap
  • saml

LoginRequest

Properties

PropertyTypeRequiredDescription
typeEnum<'email' | 'username' | 'phone' | 'magic-link' | 'social'>Login method
emailstringoptionalRequired for email/magic-link
usernamestringoptionalRequired for username login
passwordstringoptionalRequired for password login
providerstringoptionalRequired for social (google, github)
redirectTostringoptionalRedirect URL after successful login

LoginType

Allowed Values

  • email
  • username
  • phone
  • magic-link
  • social

RefreshTokenRequest

Properties

PropertyTypeRequiredDescription
refreshTokenstringRefresh token

RegisterRequest

Properties

PropertyTypeRequiredDescription
emailstring
passwordstring
namestring
imagestringoptional

Session

Properties

PropertyTypeRequiredDescription
idstring
expiresAtstring
tokenstringoptional
ipAddressstringoptional
userAgentstringoptional
userIdstring

SessionResponse

Properties

PropertyTypeRequiredDescription
successbooleanOperation success status
error{ code: Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | … +265 more>; message: string; category?: string; httpStatus?: integer; … }optionalError details if success is false
meta{ timestamp: string; duration?: number; requestId?: string; traceId?: string }optionalResponse metadata
data{ session: object; user: object; token?: string }

SessionUser

Properties

PropertyTypeRequiredDescription
idstringUser ID
emailstringEmail address
emailVerifiedbooleanIs email verified?
namestringDisplay name
imagestringoptionalAvatar URL
usernamestringoptionalUsername (optional)
rolesstring[]Assigned role IDs
tenantIdstringoptionalCurrent tenant ID
languagestringPreferred language
timezonestringoptionalPreferred timezone
createdAtstringoptional
updatedAtstringoptional

UserProfileResponse

Properties

PropertyTypeRequiredDescription
successbooleanOperation success status
error{ code: Enum<'VALIDATION_ERROR' | 'INVALID_FIELD' | 'MISSING_REQUIRED_FIELD' | … +265 more>; message: string; category?: string; httpStatus?: integer; … }optionalError details if success is false
meta{ timestamp: string; duration?: number; requestId?: string; traceId?: string }optionalResponse metadata
data{ id: string; email: string; emailVerified: boolean; name: string; … }

On this page