OAuth mode
- Last Updated: December 23, 2025
- 7 minute read
- OpenEdge
- Version 12.8
- Documentation
OAuth mode is an authentication option for service accounts where the MCP server validates tokens using JSON Web Key Set (JWKS) from an external OAuth or OpenID Connect provider. This mode is designed for enterprise deployments that require integration with identity providers and support for separate service account and user tokens.
|
OAuth authentication modes
OAuth-based authentication provides flexibility for integrating MCP with external identity providers and enabling Single Sign-On. These modes allow secure token validation and forwarding to downstream APIs.
- OAuth SSO mode—When
sso_mode=true, the server automatically:- Forces
mode="oauth" - Sets the header to
Authorization - Applies the prefix
Bearer - Sets
user_auth.enabled: falsebecause the service account token is used for both authentication and authorization. - Exposes the OAuth RFC 9728 protected resource metadata endpoint automatically.
- Includes the
resource_metadataparameter inWWW-Authenticateheaders for enhanced client discovery.
{ "service_account": { "enabled": true, "mode": "oauth", "header": "Authorization", "prefix": "Bearer ", "issuer": "https://auth.example.com/realms/myapp", "jwks_uri": "https://auth.example.com/realms/myapp/certs", "algorithms": ["RS256"], "audience": "mcp-server-api", "required_scopes": ["api.access"], "advertised_scopes": ["api.read", "api.write"], "sso_mode": true, "bearer_methods_supported": ["header"], "require_metadata_on_401": true, "resource_documentation": "https://docs.example.com/api", "authorization_servers": ["https://auth.example.com/realms/myapp"] }, "user_auth": { "enabled": false } } - Forces
- OAuth2 proxy mode (delegated authentication)—When
mode="oauth"withclient_idandclient_secretconfigured, the server acts as an OAuth2 authorization server implementing Authorization Code and PKCE flow while delegating user authentication to external identity providers such as Keycloak, Azure AD, or AWS Cognito. Use this mode when MCP clients need to obtain OAuth tokens through the MCP server. - Individual modes:—You can use either of these modes:
- SSO only—MCP client brings an existing OAuth token, which the server validates and forwards.
- Proxy only—MCP client obtains an OAuth token from the MCP server without downstream forwarding.
OAuth2 endpoints and metadata
| Proxy endpoint | Purpose |
|---|---|
GET /authorize |
Starts the OAuth2 authorization flow and redirects to the external provider |
POST /token |
Exchanges the authorization code for an access token and validates PKCE |
GET /oauth/callback |
Handles the callback from the external OAuth provider after user authentication |
| Metadata endpoint | Standard | Exposure condition | Purpose |
|---|---|---|---|
| /.well-known/oauth-authorization-server | RFC 8414 | Exposed automatically when OAuth2 proxy mode is active | Provides OAuth2 server metadata, including authorization and
token endpoints, supported grant types
(authorization_code), response types
(code), and PKCE code challenge methods
(S256, plain). |
| /.well-known/oauth-protected-resource | RFC 9728 | Exposed only when service account authentication is enabled | Provides protected resource metadata, including authorization servers, supported scopes, bearer methods, and other compliance details for OAuth client discovery. |
When authentication fails, the MCP server provides additional metadata in the response to
guide clients in obtaining valid credentials. If
require_metadata_on_401=true, which is the default value, all
401 responses include a WWW-Authenticate header with the Bearer
realm and a resource_metadata parameter pointing to the protected
resource metadata endpoint. This helps clients discover the correct OAuth
configuration.
OAuth2 authentication patterns
- External OAuth flow (SSO mode only)—Used when client applications already have OAuth
integration with an enterprise identity provider. The MCP server validates
the token and forwards it to downstream APIs. The following example shows
how to configure external OAuth flow:
{ "service_account": { "enabled": true, "mode": "oauth", "sso_mode": true, "issuer": "http://localhost:8082/realms/mcp", "jwks_uri": "http://localhost:8082/realms/mcp/protocol/openid-connect/certs", "audience": "mcp-client", "algorithms": ["RS256"], "required_scopes": ["mcp_access"] } }Note: The configuration provided in the example does not includeclient_idorclient_secret. As a result, OAuth endpoints are not provided by the MCP server in this pattern.These steps explain how the external OAuth flow works:- Client obtains OAuth token directly from Keycloak or Azure.
- Client uses token to call MCP server tools.
- MCP server validates token through JWKS and executes tools.
- MCP server forwards the same token to downstream APIs.
- MCP server OAuth flow (standard pattern)—Simplifies client OAuth integration by
allowing the MCP server to handle identity provider-specific details. The
following example shows how to configure MCP server OAuth flow:
These steps explain how the flow works:{ "service_account": { "enabled": true, "mode": "oauth", "sso_mode": true, "issuer": "http://localhost:8082/realms/mcp", "jwks_uri": "http://localhost:8082/realms/mcp/protocol/openid-connect/certs", "client_id": "mcp-client", "client_secret": "your-client-secret-here", "audience": "mcp-client", "algorithms": ["RS256"], "required_scopes": ["mcp_access"], "advertised_scopes": ["openid", "profile", "email", "mcp_access"] } }- The client initiates the OAuth process through the MCP server by
calling the
/authorizeendpoint and then the/tokenendpoint. - The MCP server delegates user authentication to an external identity provider such as Keycloak or Azure.
- After successful authentication, the client receives an external provider token from the MCP server.
- The client uses this token to call MCP server tools.
- The MCP server validates the token and executes the requested tools.
- Finally, the MCP server forwards the same token to downstream APIs for further processing.
- The client initiates the OAuth process through the MCP server by
calling the
- Standard OAuth2 pattern (proxy and SSO combined)—Most deployments use
both features together. This pattern works as follows:
- Set
sso_modetotrueto forward the same token to downstream APIs. - Configure
client_idandclient_secretto provide OAuth endpoints for MCP clients.
- Set
PKCE flow for secure OAuth2 authentication
The MCP server implements the OAuth2 authorization code flow with Proof Key for Code Exchange (PKCE) to secure authentication for public clients such as browser-based MCP clients. PKCE adds cryptographic proof to prevent interception attacks by ensuring that the client initiating the authorization request is the same client exchanging the authorization code for tokens.
- The user initiates the process through the MCP client, which interacts with the MCP server and the identity provider.
- During the discovery step, the client communicates with the MCP server to
retrieve OAuth2 metadata from the
/.well-known/oauth-authorization-serverendpoint. - In the authorization step, the client sends an authorization request to the
identity provider that includes a
code_challenge. - The identity provider responds by returning an authorization code to the client in the callback step.
- For token exchange, the client sends the authorization code along with the
code_verifierto the MCP server at the/tokenendpoint. - For the backend exchange, the MCP server uses its
client_secretto exchange the code with the identity provider and obtain tokens. - Finally, the client uses the issued token to call MCP server APIs by
including the
Authorization: Bearerheader in its requests.
The sequence diagram shows the steps involved in the PKCE flow, including discovery, authorization, callback, token exchange, backend exchange, and API calls. It highlights how the MCP client and MCP server interact with the identity provider to complete the OAuth2 Authorization Code flow securely.
| Role | Description |
|---|---|
| Identity provider (Keycloak or Azure AD) | Acts as the authentication server and verifies user credentials. |
| OpenEdge MCP server |
|
| MCP client | Acts as the OAuth2 client, initiates the flow, receives tokens, and makes API calls. |
| Parameter | Description |
|---|---|
code_challenge |
A SHA256 hash of a random code_verifier sent
in the authorization request. |
code_verifier |
A random string of 43 to 128 characters sent during token exchange. |
code_challenge_method |
Specifies the hashing method used for the challenge. The
recommended value is S256 for SHA256 hashing,
which is more secure than plain. |
- Public client security without requiring a client secret.
- Protection against authorization code interception attacks.
- Cryptographic binding between the authorization request and token exchange.
Token exchange pattern for PAS for OpenEdge integration
The MCP server uses token exchange to integrate with Progress Application Server (PAS) for OpenEdge back-end systems. Token exchange allows the server to replace an inbound user token with a PAS for OpenEdge-scoped token that has different claims, a shorter lifetime, and limited scopes. This approach enforces the principle of least privilege and improves security for downstream API calls.
| Component | Description |
|---|---|
| OpenEdge MCP server | Acts as a token exchange server. It receives the user token and exchanges it for a PAS for OpenEdge-scoped token. |
| PAS for OpenEdge SSO/Identity service | Provides an external token exchange endpoint that issues PAS for OpenEdge-compatible tokens. |
The sequence diagram shows the steps involved in token exchange pattern flow:

- The client sends a service account token in the
X-OEMCP-SERVICEACCOUNTheader and a user token in theAuthorizationheader. - The MCP server validates the service account token for MCP access.
- The MCP server extracts the user token and sends it to the PAS for OpenEdge token exchange endpoint.
- The PAS for OpenEdge identity service validates the user token and returns a PAS for OpenEdge-scoped access token.
- The MCP server uses the exchanged token to call PAS for OpenEdge downstream APIs.
- The MCP server returns the tool results to the client.
|
- Principle of least privilege—PAS for OpenEdge receives tokens that contain only the necessary scopes and audience, ensuring minimal permissions for backend operations.
- Reduced token lifetime—Exchanged tokens are issued with a shorter expiration period, which limits the time window for potential misuse in backend systems.
- Audience isolation—PAS for OpenEdge tokens are scoped specifically for backend systems, preventing their use in unintended contexts or external services.
- Fail-closed security—If the token exchange process fails, the request is aborted and does not fall back to the original token, maintaining strict security controls.