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

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

SessionResponse

Properties

PropertyTypeRequiredDescription
successbooleanOperation success status
errorObjectoptionalError details if success is false
metaObjectoptionalResponse metadata
dataObject

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
errorObjectoptionalError details if success is false
metaObjectoptionalResponse metadata
dataObject

On this page