API key authentication
An API key verifies the caller’s identity and authorizes access to API resources with a single string secret. VeADK passes the API key in the URL’stoken parameter.
API keys apply only to the A2A / MCP Server deployment mode; they are not recommended for the VeADK Web mode, which should use OAuth2 instead.
--auth-method=api-key when deploying an existing project. The API gateway then validates the API key carried in the token URL parameter on each request.
OAuth2 single sign-on
OAuth2 is an open authorization framework: instead of exposing account credentials, it grants limited access via tokens, so a single login lets users reach multiple related applications without re-authenticating. VeADK offers two integration paths:API gateway
For VeADK Web apps deployed on VeFaaS, where the API gateway runs the OAuth2 flow.The API gateway mode requires API gateway version 4.0.0 or later.
--auth-method=oauth2 when deploying an existing project; VeADK creates the Identity user pool and client for you. To reuse existing resources, pass --user-pool-name and --client-name at deploy time.
After deploying, create users in Agent Identity:
1
Open the user pool
In the Volcengine console, go to Agent Identity, select Authentication › User Pools, and choose your pool.
2
Create a user
On the pool’s Users tab, click New User, fill in the details, and confirm.
Authorization header.
Starlette / FastAPI middleware
For local development or self-hosted deployment, VeADK’s middleware handles OAuth2 inside the app and supports any Starlette-based framework (including FastAPI). PreferOAuth2Config.from_veidentity(), which auto-configures a VeIdentity user pool:
FastAPI() for Starlette().
To reuse existing resources, disable auto-creation:
OAuth2Config directly:
You can exempt paths from auth:
exempt_paths=["/health", "/metrics"] (exact match) and exempt_prefixes=["/public/", "/static/"] (prefix match). The middleware responds by request type: browser requests redirect to the login page; API requests get a 401. API requests are detected via the Accept: application/json header, a path prefix (default /api/), or the X-Requested-With: XMLHttpRequest header, and can be customized with api_path_prefixes.
Key OAuth2Config.from_veidentity() parameters:
Key
OAuth2Config parameters:
The default
InMemoryStateStore fits single-process deployments only. For distributed setups, implement a state store backed by Redis or similar and pass it via setup_oauth2(app, config, state_store=...).OAuth2 JWT authentication
OAuth2 JWT auth combines the OAuth2 framework with JWT, carrying the authorization token as a JWT. It applies to A2A / MCP Server. Select OAuth2 when scaffolding an agent, or add--auth-method=oauth2 when deploying; VeADK creates the Identity user pool, or reuses one via --user-pool-name. Then create an M2M client in the pool and exchange its credentials for a JWT:
Authorization header.