Why Authentication Matters
In an agent network, trust should not depend on a hidden allowlist or a private convention. A caller needs a standard way to obtain credentials, present them, and be checked before access is granted.| Unauthenticated access | Bindu authentication |
|---|---|
| Easy for local testing | Safer for production access control |
| No formal identity at request time | OAuth2 tokens define who is calling |
| Hard to apply consistent policy | Hydra provides a standard token workflow |
| Weak boundary between caller and API | Requests are checked before protected actions run |
| Fine for experiments | Better for networked and production agents |
If an agent is exposed beyond local development, it should not rely on obscurity for
security. It should be able to verify who is calling before sensitive work begins.
How Bindu Authentication Works
Bindu uses Ory Hydra as its authentication backend for production deployments. Authentication is optional, so you can still run agents without it for development and testing.The Authentication Model
Bindu uses a straightforward token flow:- The agent is registered as an OAuth client.
- Hydra issues a
client_secret. - The caller exchanges credentials for an access token.
- The token is sent with the API request and validated before access is granted.
Standard
Authentication follows an OAuth2 client credentials flow instead of a custom ad hoc
scheme.
Scoped
Access tokens carry explicit scopes such as
agent:read and agent:write.Verifiable
Tokens can be introspected against Hydra so access decisions are made with a trusted
source of truth.
The Lifecycle: Register, Mint, Verify
Let’s break the flow down first, then walk through each stage. What this means is simple: Bindu turns agent access into a repeatable trust flow instead of a custom one-off secret exchange.Register
During
bindufy, the agent is registered with Hydra as an OAuth client using the
full DID string as the client_id. Hydra returns the client_secret needed for
future token requests.Bindu saves these OAuth credentials to oauth_credentials.json inside the agent’s
credentials directory, which defaults to .bindu/. The file is a map keyed by
agent DID.Mint
When you deploy your agent, obtain an access token using the OAuth2 client
credentials flow.Bindu registers Hydra clients with
Your credentials come from two places:
token_endpoint_auth_method=client_secret_post, which means token requests should
send the client_id and client_secret in the form body.- Agent DID: Found in the agent card at
/.well-known/agent.json - Client Secret: Typically located in
.bindu/oauth_credentials.json
Verify
When If
AUTH__ENABLED=true, Bindu installs HydraMiddleware on the agent server.
For non-public endpoints, it intercepts the request, reads the bearer token from
the Authorization header, and introspects that token against the Hydra Admin API.AUTH__REQUIRE_PERMISSIONS=true, Bindu will also enforce method-specific scopes
like agent:read and agent:write before the request reaches the handler.Optional: if X-DID, X-DID-Signature, and X-DID-Timestamp headers are present,
Bindu can perform an additional cryptographic DID-signature verification step on the
request body.Configuration
Authentication should be easy to enable when you need it and easy to avoid when you do not. Bindu keeps the configuration surface intentionally small.Environment Variables
Configure Hydra via environment variables:/oauth2/token and Hydra’s Admin API for token introspection at /admin/oauth2/introspect.
Agent Configuration
No additional configuration is needed in your agent code. Authentication is handled automatically when the required environment variables are set. This is deliberate. Your agent definition stays focused on behavior, while the environment decides whether the runtime should enforce authentication.Standards
OAuth2
Hydra uses the OAuth2 client credentials flow so agents can obtain tokens through a
standard authentication model.
Ory Hydra
Hydra acts as the centralized authority for client registration, token minting, and
token validation.
Scoped Access
Scopes like
openid, offline, agent:read, and agent:write keep access
explicit.Getting Access Tokens
There are two practical ways to get a token depending on whether you want direct API control or a simpler testing workflow.Method 1: API Request
Use the OAuth2 token endpoint directly when you want explicit control over the authentication flow:Method 2: UI
Use the frontend UI to obtain tokens more easily during testing:-
Start the frontend:
-
Navigate to
Settings -> Authentication. -
Enter your
CLIENT_SECRET, typically found in.bindu/oauth_credentials.json. - Click Get Access Token.
- Copy the generated token.
The Value of Authenticated Access
Authentication only matters if it creates a cleaner and safer trust boundary. This model gives you:- Controlled access: protected methods are no longer open by default.
- Standardized identity checks: tokens flow through a well-known OAuth2 model.
- Clearer trust boundaries: the API can validate who is calling before sensitive work starts.
Real-World Use Cases
Protected production agents
Protected production agents
When an agent is exposed publicly or shared across teams, Hydra-backed
authentication ensures only token-bearing callers can reach protected
functionality.
Automated service-to-service access
Automated service-to-service access
If one service or agent needs to call another automatically, the client
credentials flow gives it a clean way to request an access token
programmatically.
Frontend-assisted testing
Frontend-assisted testing
During local or pre-production testing, the frontend UI gives developers a
faster path to token generation without manually crafting every request.
Security Best Practices
Keep Client Secrets Private
Treat the generated OAuth credentials file, typically
.bindu/oauth_credentials.json, as sensitive material and never expose the
client_secret publicly.Use Scopes Deliberately
Request only the scopes you actually need so access remains narrow and
explicit.