OpenID Connect Core 1.0 & OAuth 2.1 Standard

SSO Integration Guide for Satellite Applications

For: Software Engineers & Technical Leads developing applications in the OneXCC Network (digital portals, internal tools, partner platforms).

Enforced PKCE S256Authorization Code FlowIssuer: https://iam.xcc.one/api/authMCP Host Ready (RFC 8707 & RFC 7591)
For AI Agents & CLI Automation

Quick Reference for Agents & Terminal

Machine-readable parameters and live curl test commands designed for automated coding agents and DevOps automation:

Discovery Endpoint (JSON)
/.well-known/openid-configuration
JWKS URI (Public Keys)
/jwks
Dynamic Registration (RFC 7591)
POST /oauth2/register (403)
Token Revocation (RFC 7009)
POST /oauth2/revoke
Section 1Standard OIDC / OAuth 2.1 Architecture

XCC IAM serves as a fully compliant OpenID Connect Provider. All relying party applications authenticate using Authorization Code Flow with mandatory PKCE (S256).

Core Protocol Endpoints
EndpointMethodURL PathUsage
Issuer URLURIhttps://iam.xcc.one/api/authToken Issuer Identifier (Issuer URI)
OIDC Discovery (Machine/SDK)GEThttps://iam.xcc.one/.well-known/openid-configurationAutomatic server metadata discovery for machine SDKs (RFC 8414)
JWKS EndpointGEThttps://iam.xcc.one/jwksPublic keys for decoding & verifying JWT ID Tokens
AuthorizationGET / POSThttps://iam.xcc.one/oauth2/authorizeUser sign-in & consent delegation interface
Token EndpointPOSThttps://iam.xcc.one/oauth2/tokenExchange Authorization Code for Access & ID Tokens
OAuth Server Metadata (RFC 8414)GEThttps://iam.xcc.one/.well-known/oauth-authorization-serverOAuth 2.1 Authorization Server Metadata per RFC 8414
Protected Resource (RFC 9728)GEThttps://iam.xcc.one/.well-known/oauth-protected-resource/api/mcpOAuth 2.0 Protected Resource Metadata (RFC 9728) for MCP Server
UserInfo EndpointGET / POSThttps://iam.xcc.one/oauth2/userinfoRetrieve authenticated user claims via Bearer Token (canonical discovery endpoint: /oauth2/userinfo; alias: /userinfo)
Dynamic Client Registration (RFC 7591)POSThttps://iam.xcc.one/oauth2/registerDynamic Client Registration (RFC 7591) is disabled (returns HTTP 403 access_denied and omitted from discovery); provision OAuth clients manually in /admin/projects
Token Revocation (RFC 7009)POSThttps://iam.xcc.one/oauth2/revokeInstantly revoke Access or Refresh Tokens per RFC 7009
Token Introspection (RFC 7662)POSThttps://iam.xcc.one/oauth2/introspectToken Introspection endpoint (RFC 7662)
OIDC End-Session (Logout)GET / POSThttps://iam.xcc.one/oauth2/end-sessionOIDC RP-Initiated End-Session (Logout) endpoint

Endpoint Specification (API Reference)

Detailed parameter breakdown, HTTP headers, request formats, and response schemas for each endpoint:

GEThttps://iam.xcc.one/oauth2/authorize

Initiate user authorization session and request an Authorization Code via the browser (Browser-based flow).

ParamTypeStatusDescription
client_idstringRequiredOAuth Client ID obtained when an administrator creates the application in the Admin Console (/admin/projects).
redirect_uristringRequiredCallback URL matching one of the whitelisted redirect URIs exactly.
response_typestringRequiredMust be set to fixed value: code
scopestringRequiredRequested scopes, must include openid (e.g. openid profile email mcp:access).
resourcestringOptionalProtected Resource Indicator per RFC 8707 (e.g. https://mcp.example.com/api). Access Token JWT aud claim will be bound to this URI.
code_challengestringRequiredPKCE hash: BASE64URL(SHA256(code_verifier)).
code_challenge_methodstringRequiredMust be set to fixed value: S256
statestringRecommendedOpaque random string generated by client to mitigate CSRF attacks.
trackstringOptionalSpecifies account track: personal or enterprise (supports aliases account_type, user_type). If passed, XCC IAM locks the UI to that track and hides the 2-tab switcher; if omitted, both tabs are displayed for user selection.
Section 23-Step Integration Workflow

Connect Single Sign-On in three simple steps:

1Register Client on XCC IAM Console

Administrators navigate to OAuth Clients Console, click Create Client and provide:

  • Name: Application name shown on consent screen (e.g. OneXCC Portal Production).
  • Redirect URIs: Whitelisted callback URLs (e.g. https://app.example.com/api/auth/callback/xcc-iam, http://localhost:3101/api/auth/callback/xcc-iam for dev).
Important notice:Client Secret is shown only once upon creation. Store it immediately into your Secret Vault / .env.enc.
2Configure Environment Variables

Declare OIDC parameters in .env.local or your satellite app's production configuration:

.env.local
dotenv
OIDC_ISSUER=https://iam.xcc.one/api/auth
OIDC_CLIENT_ID=your_assigned_client_id
OIDC_CLIENT_SECRET=your_assigned_client_secret
OIDC_REDIRECT_URI=https://app.example.com/api/auth/callback/xcc-iam
OIDC_SCOPES="openid profile email"

# Dedicated for AI IDEs & MCP Hosts (Public Native Clients - No Secret Needed):
# Tạo OAuth Client tại Admin Console (/admin/projects) để nhận client_id thực tế
# Cursor IDE redirect_uri: cursor://anysphere.cursor-retrieval/auth
# Antigravity redirect_uri: antigravity://auth
# Scopes: "openid profile email offline_access mcp:access"
# Target Resource (Ví dụ): "https://mcp.example.com/api"
3Client Code Implementation

Integrate your authentication client library using the code samples below:

src/modules/auth/auth.ts (Consumer App)
typescript
import { betterAuth } from "better-auth";
import { genericOAuth } from "better-auth/plugins";

export const auth = betterAuth({
  plugins: [
    genericOAuth({
      config: [
        {
          providerId: "xcc-iam",
          clientId: process.env.OIDC_CLIENT_ID!,
          clientSecret: process.env.OIDC_CLIENT_SECRET!,
          discoveryUrl: "https://iam.xcc.one/.well-known/openid-configuration",
          scopes: ["openid", "profile", "email"],
          pkce: true, // Bắt buộc bật PKCE S256 theo tiêu chuẩn XCC IAM
        },
      ],
    }),
  ],
});
Section 3Received User Claims Payload

After successful authentication and consent approval, the client application receives an ID Token and UserInfo response containing standard claims:

User Claims (ID Token / UserInfo)
json
{
  "sub": "usr_xcc_123456789",
  "email": "[email protected]",
  "name": "Nguyễn Văn A",
  "image": "https://avatar.xcc.one/avatar.png",
  "email_verified": true
}
Section 4Mandatory Security Principles

Mandatory PKCE (RFC 7636 S256)

All client applications (including SPAs, Mobile Apps, and Server-rendered apps) must enforce PKCE S256 to eliminate Authorization Code interception attacks.

Exact Redirect URI Matching

All callback URLs must be pre-registered character-for-character. XCC IAM immediately rejects authorization if redirect_uri differs by port or scheme.

Never Expose Client Secret to Frontend

Client Secrets must only be stored and used within server-side runtimes. Never bundle secrets into client JavaScript or public code repositories.

Section 5Persona Track Locking (Personal vs Enterprise Tab Management)

When redirecting users to XCC IAM, your relying party application can proactively control the active account track via request parameters (track, account_type, user_type):

Enterprise / B2B / Workspace Applications:

Append track=enterprise (or account_type=enterprise) to the authorization URL. XCC IAM completely hides the 2-tab switcher and locks the UI into Enterprise mode with company email fields.

Enterprise Track Authorization URL
text
https://iam.xcc.one/oauth2/authorize?client_id=...&redirect_uri=...&response_type=code&scope=openid+profile&track=enterprise
Personal / B2C / Mobile Applications:

Append track=personal (or account_type=personal). XCC IAM hides the tab switcher and locks the UI into Personal ID mode. If no account type is specified, XCC IAM renders both tabs for the user to choose.

Personal Track Sign-in URL
text
https://iam.xcc.one/sign-in?track=personal&callbackURL=https://app.example.com/dashboard
Section 6AI Agent & MCP Host Integration (Model Context Protocol)

XCC IAM provides native OAuth 2.1 authorization with RFC 8252 Custom URL Schemes, Resource Indicators (RFC 8707), and PKCE S256 tailored for AI IDE hosts (Cursor, Google Antigravity, Trae, Claude Desktop, VS Code) connecting to remote MCP servers.

1. Registering Native Public Client for IDE / MCP Host
Native Public Client

Because Dynamic Client Registration (DCR) is disabled in production, each IDE workstation or MCP host must use a pre-seeded OAuth Client or one created manually in the Admin Console (/admin/projects). Desktop/IDE tools run as Native Public Clients (token_endpoint_auth_method: "none", PKCE S256 enforced, no client_secret required or permitted):

Steps to create an OAuth Client in Admin Console (/admin/projects):
  • 1. Open Admin Console (/admin/projects) -> Select your Project -> Click 'Create OAuth Client'.
  • 2. Provide an Application Name (e.g. 'Cursor IDE - Dev Machine', 'Google Antigravity MCP', 'Trae IDE').
  • 3. Select Application Type: Native / Public Client (the system enforces no client_secret and mandates PKCE S256).
  • 4. Enter the Redirect URIs matching your IDE (refer to the scheme table below).
  • 5. Grant Scopes: 'openid profile email mcp:access offline_access' and associate the target MCP Resource Server (e.g. https://mcp.example.com/api).
  • 6. Save and copy the newly generated client_id (e.g. clnt_...) to configure your IDE or MCP agent.
IDE Redirect URI & Custom Scheme Reference Table:
Cursor IDECustom Scheme & Loopback
Redirect URIs:cursor://anysphere.cursor-retrieval/auth, cursor://anysphere.cursor-mcp/oauth/callback, http://localhost:8787/callback, http://127.0.0.1:8080/callback
Google Antigravity IDECustom Scheme & HTTPS Callback
Redirect URIs:antigravity://auth, antigravity://auth/callback, https://antigravity.google/oauth-callback, http://127.0.0.1:8080/callback
Trae IDECustom Scheme & Loopback
Redirect URIs:trae://auth, trae://auth/callback, http://127.0.0.1:8080/callback
Claude DesktopCustom Scheme & Loopback
Redirect URIs:claude://auth/callback, http://127.0.0.1:8080/callback
VS Code / Generic AgentCustom Scheme & Loopback
Redirect URIs:vscode://auth/callback, http://localhost:8787/callback, http://127.0.0.1:8080/callback
2. Scopes & Persistent Refresh Tokens (offline_access & mcp:access)

Requesting offline_access is mandatory for persistent IDE sessions. Access tokens expire after 1 hour; offline_access issues a cryptographically verified refresh_token so the IDE can silently renew tokens in the background via grant_type=refresh_token without interrupting the developer.

Required scopes:openid profile email offline_access mcp:access
3. Dynamic Client Registration Policy (RFC 7591 DCR — Disabled)

XCC IAM enforces an Admin-Gated Client Registry: RFC 7591 Dynamic Client Registration is disabled (allowDynamicClientRegistration: false). Both POST /oauth2/register and POST /api/auth/oauth2/register return HTTP 403 (error: 'access_denied'), and discovery metadata (/.well-known/openid-configuration and /.well-known/oauth-authorization-server) omits registration_endpoint.

RFC 7591 DCR Status (POST /oauth2/register -> 403 access_denied)
bash
# RFC 7591 Dynamic Client Registration is DISABLED on XCC IAM.
# Discovery omits registration_endpoint and POST /oauth2/register always returns 403 access_denied:
curl -i -X POST https://iam.xcc.one/oauth2/register \
  -H "Content-Type: application/json" \
  -d '{"client_name":"Test","redirect_uris":["http://localhost:8787/callback"],"token_endpoint_auth_method":"none"}'
# HTTP/1.1 403 Forbidden -> {"error":"access_denied","error_description":"Dynamic client registration is disabled..."}
# Provision OAuth 2.1 / MCP clients manually at https://iam.xcc.one/admin/projects
All new OAuth 2.1 / MCP clients must be pre-seeded or created manually by an administrator in /admin/projects with PKCE S256 enforced.
4. Authorization Flow with Resource Indicators (RFC 8707 & PKCE S256)

The IDE initiates an authorization code request with scope mcp:access, offline_access, and the resource parameter targeting the MCP server:

Authorization URL with RFC 8707 Resource & PKCE S256
text
https://iam.xcc.one/oauth2/authorize?
  response_type=code&
  client_id=YOUR_CLIENT_ID&
  redirect_uri=cursor%3A%2F%2Fanysphere.cursor-retrieval%2Fauth&
  scope=openid+profile+email+offline_access+mcp%3Aaccess&
  resource=https%3A%2F%2Fmcp.example.com%2Fapi&
  code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM&
  code_challenge_method=S256
5. Exchange Code for Resource-Bound JWT & Silent Token Refresh

The IDE exchanges the authorization code for an aud-bound access token and refresh token, then renews the token silently via grant_type=refresh_token:

Token Exchange with Resource (POST /oauth2/token)
bash
# 1. Đổi Authorization Code lấy Resource-Bound Access Token & Refresh Token:
curl -X POST https://iam.xcc.one/oauth2/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=authorization_code" \
  -d "client_id=YOUR_CLIENT_ID" \
  -d "redirect_uri=cursor://anysphere.cursor-retrieval/auth" \
  -d "code=AUTHORIZATION_CODE_RECEIVED" \
  -d "code_verifier=YOUR_PKCE_CODE_VERIFIER" \
  -d "resource=https://mcp.example.com/api"
Silent Token Refresh via offline_access (POST /oauth2/token)
bash
# 2. Tự động làm mới Access Token ngầm (Silent Token Renewal via offline_access):
curl -X POST https://iam.xcc.one/oauth2/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=refresh_token" \
  -d "client_id=YOUR_CLIENT_ID" \
  -d "refresh_token=YOUR_REFRESH_TOKEN" \
  -d "resource=https://mcp.example.com/api"
6. Audit Trail & Instant Revocation (RFC 7009 & Admin Console)

All mcp:access delegations are logged to the audit system (oauth_consent.grant). Administrators can revoke access from the Admin Console, and clients can revoke tokens via POST /oauth2/revoke.

Ready to integrate with OneXCC Network?

Create your first OAuth Client in 30 seconds or inspect the live Discovery Endpoint.