Request authorization
Use OAuth Authorization Code with PKCEPKCEProof Key for Code Exchange: binds an authorization request to the later code exchange so a stolen code is useless. S256 against the per-resource AIGW authorization endpoint.
Create PKCE and state
Generate:
- high-entropy
code_verifier; code_challenge = BASE64URL(SHA256(code_verifier));- random
statetied to the current transaction.
Store the verifier and state until the callback completes.
Build the authorization URL
GET https://api.aigw.eval.loginid.ai/<RESOURCE_ID>/oauth2/auth
?response_type=code
&client_id=<AGENT_CLIENT_ID>
&redirect_uri=https://agent.example.com/callback
&scope=openid%20search:read
&state=<STATE>
&code_challenge=<CODE_CHALLENGE>
&code_challenge_method=S256
Request only the scopes needed for the MCPMCPModel Context Protocol: a standard way for AI agents to call tools and data sources exposed by a server./UCP operation.
User experience
The authorization request opens a browser flow controlled by AIGW:
- the user authenticates with an identity provider enabled on the ResourceResourceThe downstream system registered in a Project. Its kind (Token exchange or OAuth client) decides the role AIGW plays.;
- AIGW presents the consent request and configured scope descriptions;
- the user approves or denies;
- on approval, AIGW redirects to the agent's registered callback with an authorization code and state.

The Resource operator can customize the sign-in and consent appearance/text in AIGW.

Approval can still block the flow
User consent is not the same as project-level agent approval. A pending/rejected/revoked agent can be denied even if its OAuth request is otherwise well formed. Whether a new agent is approved automatically or held depends on the ProjectProjectThe isolation boundary for an integration. It holds Resources, agents and agent policy, end users, and Proxy clients.'s Agent policy.
Continue to Handle the callback.