Authentication
Authentication
Authenticate with Agnic using OAuth2 or API tokens
Authentication
Agnic supports two authentication methods to access the API and AI Gateway.
Authentication Methods
OAuth2 Integration
Let users authorize your app to sign transactions on their behalf
API Tokens
Generate tokens for direct API access in scripts and applications
Available Scopes
Control what permissions your tokens have
Which Should I Use?
| Use Case | Recommended Method |
|---|---|
| Your own scripts/agents | API Tokens |
| CI/CD pipelines | API Tokens |
| Third-party app integration | OAuth2 |
| User-facing applications | OAuth2 |
| MCP servers | API Tokens |
| N8N workflows | OAuth2 |
Quick Comparison
| Feature | API Tokens | OAuth2 |
|---|---|---|
| Setup complexity | Simple | Moderate |
| User authorization | Not required | Required |
| Spending limits | Set by you | Set by user |
| Token lifespan | Until revoked | 30-60 days |
| Best for | Personal use | Multi-user apps |
Token Formats
All Agnic tokens follow a predictable format:
| Prefix | Type | Description |
|---|---|---|
agnic_tok_ | API Token | Direct API access token |
agnic_at_ | Access Token | OAuth2 access token |
agnic_rt_ | Refresh Token | OAuth2 refresh token |