How it works
Start the connector consent flow
Redirect the user to
https://aveid.net/connect with the target resource key, the scopes you want, and the communication mode.resource is the resource key of the target Ave-registered resource (not a URL). scope must be one of the scopes defined by the target resource. mode is either user_present or background.User approves the grant
The user sees the target resource’s information and what scopes your app is requesting. They choose which identity to use and approve. If they approve, Ave redirects back to your
redirect_uri with a standard ?code=...&state=....Exchange the authorization code
Exchange the code exactly like a regular auth code flow to get a source app access token:
Exchange for a delegated token
Use the
token-exchange grant to mint a short-lived delegated JWT scoped to the target resource:Token exchange request
Must be exactly
urn:ietf:params:oauth:grant-type:token-exchange.The
access_token_jwt from the source app’s token response. The server validates this JWT to identify the user and confirm the client ID.The target resource key (as registered in the developer portal).
The scope(s) to include in the delegated token. Must be a subset of what was originally granted.
Your source app’s client ID.
Your source app’s client secret. This is a server-only call.
Token exchange response
A signed delegated JWT. Send this as the bearer token to the target resource.
Always
Bearer.Token lifetime in seconds. Delegated tokens have a fixed 10-minute TTL.
The actual scopes included in the delegated token.
The audience of the target resource. The target resource should validate this.
The target resource key.
Either
user_present or background, as set when the grant was created.Delegated JWT payload
Theaccess_token from the exchange is a JWT with the following claims:
- Signature against Ave’s JWKS
audmatches its registered audienceissishttps://aveid.netexp > nowscopecontains the required scope for the actioncidis a known/trusted source app (optional but recommended)
Server-side enforcement
Ave enforces these rules on every token exchange:subjectTokenmust decode to a valid JWT belonging to the sameclientId- The target resource must exist and be active
- The delegation grant must exist and not be revoked
requestedScopemust be a subset of the granted scoperequestedScopemust be a known scope of the target resource
Grant management
Users can revoke grants. Your app should handleaccess_denied errors gracefully:
GET /api/oauth/delegations— list active grants (requires Ave session auth)DELETE /api/oauth/delegations/:delegationId— revoke a grant
Error reference
| Error | Cause |
|---|---|
invalid_grant | subjectToken is invalid, expired, or for the wrong client |
invalid_target | Target resource key does not exist or is inactive |
access_denied | No active grant exists for this user/resource/source combination |
invalid_scope | Requested scope exceeds granted scope or is not defined by the resource |
