Skip to main content

Getting Started with JavaScript SDK

The Auth-Agent SDK is a complete server-side TypeScript/JavaScript SDK for implementing OAuth 2.1 with PKCE authentication for AI agents.

Installation

Quick Start

1. Initialize the SDK

2. Start OAuth Flow

3. Exchange Authorization Code for Tokens

4. Make Authenticated Requests

5. Refresh Tokens

Using Token Manager

The SDK includes a built-in TokenManager for simple token storage:

Agent Registration

Before using OAuth, register your agent:

Error Handling

All SDK methods throw AuthError objects with detailed information:

Next Steps

Configuration

Learn about all configuration options

AgentSDK Methods

Explore all available SDK methods

Token Manager

Learn about token management

Utilities

Utility functions for PKCE, JWT parsing, and more