TypeScript Types
Complete type reference for the Auth-Agent JavaScript/TypeScript SDK.Configuration Types
SDKConfig
Configuration object for initializing the AgentSDK.Your unique agent identifier (client ID)
Agent secret for confidential clients (optional)
Auth server URL (default:
process.env.AUTH_SERVER_URL or
'https://api.auth-agent.com')Request timeout in milliseconds (default:
10000)Custom fetch implementation for HTTP requests
Callback invoked when new tokens are received
Callback invoked when tokens are refreshed
Callback invoked when tokens are revoked
OAuth & Token Types
TokenResponse
OAuth 2.1 token response from the server.OAuth access token for API requests
Token type (always
'Bearer')Seconds until token expiration
Refresh token for obtaining new access tokens
OpenID Connect ID token (JWT)
Space-separated list of granted scopes
TokenManager
Interface for token manager state.Current access token
Current OpenID Connect ID token
Current refresh token
Token type (always
'Bearer')Token expiration timestamp in milliseconds
Space-separated list of granted scopes
AuthorizationUrlOptions
Options for generating an authorization URL.OAuth callback URL
Space-separated list of requested scopes (default:
'openid profile email agent')Custom state parameter for CSRF protection (auto-generated if not provided)
PKCEPair
PKCE code verifier and challenge pair.Random base64url-encoded string (stored for token exchange)
SHA-256 hash of code verifier (sent to authorization server)
User & Agent Types
UserInfo
OpenID Connect user information from/oauth2/userinfo endpoint.
Subject identifier (user ID)
Agent identifier
User’s display name
User’s email address
AI model name (e.g., ‘gpt-4’, ‘claude-3’)
Array of granted permissions
AgentProfile
Agent profile information.Unique agent identifier
AI model name
Agent owner’s name
Agent owner’s email
Array of agent permissions
Whether agent is disabled
ISO 8601 timestamp of creation
ISO 8601 timestamp of last update
Registration & Authentication Types
AgentRegistrationRequest
Request payload for registering a new agent.Unique identifier for the agent
Secure secret key for the agent
AI model name (e.g., ‘gpt-4’, ‘claude-3’)
Agent owner’s full name
Agent owner’s email address
AgentRegistrationResponse
Response from agent registration.Whether registration was successful
The registered agent ID
Success or error message
AgentAuthRequest
Request payload for agent authentication (legacy challenge flow).Agent identifier
Agent secret key
AI model name
OAuth client ID
OAuth redirect URI
OAuth state parameter
Requested scopes
PKCE code challenge
PKCE method (should be ‘S256’)
AgentAuthResponse
Response from agent authentication.Unique session identifier
Next step in authentication flow
URL for completing the challenge
Session expiration in seconds
Event & Verification Types
EventData
Event data for tracking and analytics.Event type/name
CSS selector or element identifier
Site or domain name
Evidence or proof of action
Event result or outcome
ChallengeResponse
Response from requesting a verification challenge.Whether request was successful
Challenge string to verify
Challenge expiration timestamp
Challenge signature
Verification context ID
Response message
VerificationConfirmRequest
Request payload for confirming verification.Challenge string from ChallengeResponse
Challenge expiration timestamp
Challenge signature
Verification context ID
IntrospectionResponse
Token introspection response.Whether token is active and valid
Space-separated list of scopes
Client identifier
Username (if available)
Token type
Expiration timestamp (Unix time)
Issued at timestamp (Unix time)
Subject identifier
Error Types
AuthError
Extended error type for authentication errors.Error code (e.g., ‘token_expired’, ‘state_mismatch’)
Human-readable error description
HTTP status code (if applicable)
state_mismatch- State parameter mismatch (CSRF)pkce_missing- Code verifier not foundtoken_expired- Access token expiredforbidden- Insufficient permissionsno_refresh_token- Refresh token not providedrefresh_failed- Token refresh failedrevoke_failed- Token revocation failedintrospection_failed- Token introspection failedno_token- Token required but not provided
Type Guards
You can use TypeScript type guards to safely work with SDK types:Complete Type Usage Example
Next Steps
Getting Started
Learn how to use the SDK
AgentSDK Methods
Explore all available methods
Configuration
SDK configuration options
Examples
See practical examples