Coding agents: Add auth to your AI agents
Let your coding agents guide you into adding auth to your agent to handle OAuth tokens and call tools on behalf of the user
Use AI coding agents to accelerate your Agent Auth integration. This guide shows you how to configure and use coding agents like Claude Code to implement Scalekit’s Agent Auth end-to-end in your AI applications.
AI-assisted development reduces implementation time from hours to minutes. The coding agent analyzes your codebase, applies authentication patterns, and generates production-ready code that follows security best practices for connecting AI agents to external services like Gmail, Calendar, Slack, and Notion.
-
Install your coding agent
Section titled “Install your coding agent”Install an AI coding agent that supports plugin ecosystems. Claude Code provides native integration with Scalekit’s authentication plugins.
Run the installation script to set up Claude Code on your system:
Security Note: Before piping to bash, verify the installer checksum or signature using the provider’s verification method, or use a signed/package-manager alternative. See the official quickstart guide for secure installation options.
Terminal curl -fsSL https://claude.ai/install.sh | bashAfter installation completes, verify setup by running:
Terminal claude --versionLearn more about Claude Code in the official quickstart guide.
-
Add the Scalekit Auth Stack marketplace
Section titled “Add the Scalekit Auth Stack marketplace”Register Scalekit’s plugin marketplace to access pre-configured authentication skills. This marketplace provides context-aware prompts and implementation guides that help coding agents generate correct Agent Auth code.
Start the Claude Code REPL and add the marketplace:
Terminal # Start Claude REPLclaude# Add Scalekit Auth Stack marketplace/plugin marketplace add scalekit-inc/claude-code-authstackWhen the marketplace registers successfully, you’ll see confirmation output:
Terminal ❯ /plugin marketplace add scalekit-inc/claude-code-authstack⎿ Successfully added marketplace: scalekit-auth-stackThe marketplace provides specialized authentication plugins that understand Agent Auth patterns and OAuth 2.0 security requirements. These plugins guide the coding agent to generate implementation code that matches your project structure.
To remove the Scalekit Auth Stack marketplace, use the uninstall command:
Claude REPL /plugin marketplace remove scalekit-auth-stack -
Enable authentication plugins
Section titled “Enable authentication plugins”Select which authentication capabilities to activate in your development environment. Each plugin provides specific skills that the coding agent uses to generate authentication code.
Run the plugin wizard to browse and enable available plugins:
Claude REPL /pluginsNavigate through the visual interface to enable the Agent Auth plugin.
Or, directly install the specific plugin:
Claude REPL /plugin install agent-auth@scalekit-auth-stackTo remove an installed plugin, use the uninstall command:
Claude REPL /plugin uninstall agent-auth@scalekit-auth-stack -
Generate authentication implementation
Section titled “Generate authentication implementation”Use a structured prompt to direct the coding agent. A well-formed prompt ensures the agent generates complete, production-ready Agent Auth code that includes all required security components.
Copy the following prompt into your coding agent:
Authentication implementation prompt Guide me through configuring the installed Scalekit marketplace plugin to handle agent authentication for Gmail. Provide the code to trigger the auth flow, retrieve the secure user token, and then use that authenticated session to fetch and list the last 5 unread emails. Add logging to verify the flow.When you submit this prompt, Claude Code:
- Loads the Agent Auth skill from the marketplace
- Analyzes your existing application structure
- Generates Scalekit client initialization
- Creates connected account management functions
- Implements OAuth authorization link generation
- Adds token fetching and refresh logic
-
Verify just-in-time implementation
Section titled “Verify just-in-time implementation”After the coding agent completes, verify that all authentication components are properly configured:
Check generated files:
- Scalekit client initialization with credentials. You may need to set up a
.envfile with your Scalekit API credentials. - Connected account management functions
- Authorization link generation
- Token fetching and storage
- Error handling for expired tokens
The authorization flow should redirect users to the service’s consent page, where they grant permissions. Your application should then be able to fetch OAuth tokens and execute actions on behalf of the authenticated user.
- Scalekit client initialization with credentials. You may need to set up a
When you connect, the agent authenticates users through the OAuth 2.0 flow you configured. Verify that protected resources require valid access tokens and that the agent can successfully execute actions on behalf of authenticated users.