Table of Contents

XAA, ID-JAG, and EMA Explained

TL;DR: Cross-App Access (XAA) is Okta’s implementation of ID-JAG, a proposed OAuth grant that lets a client use an existing corporate sign-in to request access to another service. Enterprise-Managed Authorization (EMA) applies that flow to MCP, letting companies approve connections centrally and spare users a separate consent prompt for each server. In this demo, the notes server checks OAuth scopes on each tool call, so an agent can list notes while write and delete operations are denied. Identifying individual agents that share a client registration and revoking access tokens before they expire require additional controls.

Víctor Jiménez
Víctor Jiménez

Technical Writer at RootNode

Identity and Access Gaps in the Age of Autonomous AI-cover
CSA RESEARCH
How Are Your Peers Securing AI Agents?
228 IT and security professionals share where they stand.
Download the free report

Summarize:

Read
0%
An employee views a work sign-in page beneath the words “XAA, ID-JAG, and EMA Explained.”

Table of Contents

Read
0%
Identity and Access Gaps in the Age of Autonomous AI-cover
CSA RESEARCH
How Are Your Peers Securing AI Agents?
228 IT and security professionals share where they stand.
Download the free report

When a new AI agent connects to a company’s tool, someone must decide whether to allow it. 

With standard MCP authorization, employees must access the consent screen separately for every connection, which is cumbersome: if your project has a dozen or more MCPs, you’ll end up having to click multiple times for each of them. Additionally, organizations have little visibility into this process.

The aim of EMA and XAA is to solve this issue at an organization level using a couple of OAuth extensions:

  • ID-JAG to grant access to federated, or cross-domain, scenarios.
  • Token exchange to obtain ID-JAG tokens.
  • JWT bearer grant to exchange that ID-JAG token for access tokens.

This enables EMA and XAA implementations to enforce policy-based access and provide visibility into who is accessing what.

In this article, we will:

  • Review the differences between ID-JAG, XAA, and EMA.
  • Build an example of token exchange in EMA.
  • Understand the limitations of EMA and cross-app access.

Differences Between XAA, ID-JAG, and EMA

When talking about cross-app access, ID-JAG and EMA, it’s easy to get these terms confused. They all relate to granting access to an application or agent through an Identity Provider (IdP), but they differ in specific ways.

Identity Assertion JWT Authorization Grant (ID-JAG) is an OAuth 2.0 extension proposal that allows you to reuse the SSO trust from your IdP to broker access to resources.

ID-JAG relies primarily on two OAuth extensions: Token exchange (RFC 8693) to obtain the ID-JAG token and the JWT bearer grant (RFC 7523) to exchange it for an access token.

Cross-App Access (XAA) is Okta’s implementation of the ID-JAG protocol. In this flow, Okta acts as the IdP and applies the organization’s access policies.

If you want to understand XAA in depth, the official website offers a sandbox exercise.

Enterprise-managed authorization (EMA) extends ID-JAG with some quality-of-life changes for MCPs. i.e., it specifies how MCP servers and clients should declare that they support ID-JAG. It’s being positioned as the standard mechanism to access MCP Servers through an IdP.

In summary, both XAA and EMA implement ID-JAG and are compatible with each other. They allow a company’s IdP (Okta, EntraID, …) to control which MCP servers an AI client can connect to. XAA is a general protocol, while EMA is meant for MCP.

The Cross-App EMA Access Flow 

Enterprise-Managed Authorization (EMA) is designed to grant an MCP client access to multiple MCP servers, with one IdP as the authorization broker.

In this flow, we have four entities:

  • The client, which represents the employee or an agent on the employee’s behalf.
  • The IdP (like Okta or EntraID), which will act as a broker for access.
  • The MCP authorization server, which grants access tokens as in OAuth 2.1 + PKCE.
  • The MCP resource server, which is the element that the client wants to access.

These are the steps followed in an EMA access flow:

Step 1: Login request: The client sends the user to the IdP login page. The user signs in with their corporate credentials.

Step 2: If the sign-in was successful, the IdP returns a short-lived, single-use Auth Code.

Step 3: ID token request: the client sends the authorization code to the IdP’s token endpoint. It includes the PKCE code verifier sent as the challenge in step 1 to prove it’s the same client that started the login.

Step 4: If the code, verifier, and credentials are valid, the IdP returns an ID Token (a JWT signed by the IdP)

Step 5: ID-JAG token exchange: The client asks the IdP for an ID-JAG token, using the token exchange (RFC 8693). It sends the ID Token as proof of who signed in, and includes the audience and the scope it wants.

Step 6: If the policy allows it, the IdP returns an ID-JAG JWT token.

Step 7: Access token request: The client presents the ID-JAG to the MCP Authorization Server, using the JWT bearer grant (RFC 7523), and authenticates with the credentials at that server. No browser or consent screen is required.

Step 8: The MCP Authorization Server checks if the ID-JAG is correct and that the client_id matches the client_id presenting it. It issues an access token for the MCP server, normally short-lived and without a refresh token.

Step 9 – Accessing the resource: The client calls the MCP resource, presenting the access token as a bearer token. 

Building our XAA/EMA Example

To understand XAA and EMA, we’ll create a small notepad service and MCP client that will connect to it using access via XAA/EMA granted by Okta.

In our example, you’ll first need to configure several entities in Okta, the IdP:

  1. A notes-requesting-app, which acts as the client’s registration in Okta.
  2. A notes-resource-app, as the notes authorization server registration in Okta.
  3. An AI Agent defining the approved connections.

Then, the code is split into three files, one for each actor:

  • An MCP Client that will run locally (client/run.py). A Python program that plays the role of an AI assistant. Signs the user in and asks Okta for an ID-JAG token. Then it exchanges it for an access token and calls the tools on the MCP server.
  • An MCP Authorization Server (resource_as/server.py) for the notepad service. It validates ID-JAG and issues access tokens to the resource.
  • An MCP Resource Server (mcp_server/server.py) with the notes tools. Validates the access tokens and scopes for each call.

You’ll need to edit the .env config file that contains shared configuration.

Requirements:

  • You will need an Okta account for the exercise. You can try their seven-day trial.
  • Python 3.10 or later (3.12 recommended).
  • These Python libraries: mcp, uvicorn, fastapi, httpx, pyjwt, and python-dotenv.

0. Making the Authentication Server Public

Okta requires that authentication servers are publicly accessible via HTTPS. Our example runs the authentication server in localhost:9000, so you’ll need a way to expose this port to the internet. If you are doing this on a local computer, you can use options like:

1. Register the Client App in Okta

Let’s start by registering our client app in Okta. In XAA nomenclature, client apps are called “requesting apps”, as they are the ones requesting ID-JAGs.

In Okta, create a new application called notes-requesting-app:

  1. Go to Applications and Resources → Applications → Create App Integration
  2. Select OIDC – OpenID Connect → Web Application.
  1. Name it notes-requesting-app and select “Use Okta-generated client ID”.
  2. Check the fields “Authorization code” and “Refresh token”.
  3. In the field called “Sign-in redirect URI”, enter http://localhost:8080/callback.
  4. In Assignments, choose “Skip group assignment for now” and save. 
  5. Once created, copy the “Client ID” and “Client secret” from the “General” tab.
  6. In the “Assignments” tab, assign the application to your user:
  1. In Sign-on → User Authentication, select “Okta browser plugin”.

2A. Register the Resource app

Let’s register the resource app, which will hold the records for the authentication server.

In Okta, create a second app integration called notes-resource-app:

  1. Go to Applications and Resources → Applications → Create App Integration.
  2. Select OIDC – OpenID Connect → Web Application.
  3. Name it notes-resource-app and select “Use Okta-generated client ID”.
  4. In “Sign-in redirect URI”, enter any placeholder, as users won’t need to sign in for this example.
  5. In Assignments, choose “Skip group assignment for now” and save. 
  6. Then, on the app’s “Assignment” tab, assign the application to your user, as in the previous application.

2B. Enable Cross-App Access for the Resource app

Next, tell Okta what information to include in the ID-JAG tokens so the resource authorization server accepts them. This includes:

  • The authorization server’s URL as the audience.
  • The access token scopes.

To enable “Cross-App Access’ for this application:

  1. Open the “Machine Assignments” tab, select the Callers tile, and click “Edit” next to Cross-App Access (XAA)
  2. Enable it.
  3. In the “issuer URL field”, write the public URL for the authorization server, the one we discussed in step 0.
  4. Audience/tenant ID: leave empty.
  5. Scopes: add two values: notes.read and notes.write.
  6. Save.

3. Creating an AI Agent as the approved connection

Finally, we need to register our client as an AI Agent, which is Okta’s abstraction to link the client (notes-requesting-app) with the resource’s authorization server (notes-resource-app).

In Okta, create a new AI Agent called notes-app:

  • Go to Directory → AI Agents → Register AI Agent → Register manually
  • In User access and Authentication, select an existing app: notes-requesting-app.
  • In “Profile and Owners”: fill in with your test user as owner.

The resource connection is what enables Cross-App Access: It records that this client may obtain ID-JAGs for the notes resource on behalf of its users, with those scopes.

In the list of agents, click on the one you just created. Then, in the section called Resource Connections, click on Add Resource Connection. There:

  1. Choose Application -> App configured for AI Agent access.
  2. On Application instance, select notes-resource-app.
  3. On “client ID registered in notes-resource-app”: write demo-agent.
  4. Allow specific scopes: you can select which scopes this application is allowed to use. Select only notes.read.

4. Write the .env file:

We go back to our code.

Our example uses an .env file with all the environment variables needed by the different programs to run the exercise. You have an environment file placeholder available at .env.example that you can copy:

cp .env.example .env

Then, fill in the appropriate fields directly.

# ── Okta (the enterprise IdP) ───

# Your Integrator Free org,(org authorization server)

OKTA_ISSUER=https://integrator-1234567.okta.com

# The "Requesting App" OIDC integration (Authorization Code + Refresh Token)

# OKTA_CLIENT_ID and OKTA_CLIENT_SECRET are the ones defined in Step 1.7

OKTA_CLIENT_ID='0oa195ndjdv7sdFEM698'

OKTA_CLIENT_SECRET='KR3a5rFdNLAWmD3DtDnHqMaJaYaUTGu3snInKsRjRw3OBYLgdcrU--a5u3RvMIjq'

CLIENT_REDIRECT_URI=http://localhost:8080/callback

# ── Resource authorization server (this repo) ───

# Must match EXACTLY the Issuer URL on the resource app's "Resource Server" tab in Okta.

# Okta won't accept an http, so run a tunnel (localtunnel, cloudflared) to port 9000

# and put the https tunnel URL here and in Okta.

# RESOURCE_AS_ISSUER is created in Step 0

RESOURCE_AS_ISSUER=https://great-hammer.loca.lt

# The client the agent uses at THIS AS. Put the same client ID in Okta's resource connection

# ("AI agent's client ID registered in this app") so Okta writes it into the ID-JAG.

# RESOURCE_AS_CLIENT_ID was added in step 3.3

RESOURCE_AS_CLIENT_ID=demo-agent

RESOURCE_AS_CLIENT_SECRET=change-me-to-a-long-random-string

ACCESS_TOKEN_TTL=300

AUTO_PROVISION_USERS=true

# Set to false only if your IdP's ID-JAG header doesn't carry typ=oauth-id-jag+jwt

STRICT_ID_JAG_TYP=true

# ── MCP server (this repo) ────

MCP_RESOURCE=http://localhost:8001/mcp

RESOURCE_SCOPES=notes.read

WRITES_PER_MINUTE=5

Running the Example

In our example, the client will request an ID-JAG from the IdP and use it to get an access token for a notepad application MCP. The demo flow will demonstrate both the use of ID-JAGs and how the authorization server enforces permissions with tokens’ scopes:

  1. The client will try to list notes, add a note, and delete all notes.
  2. It will be able to list notes, but will lack write permissions to add or delete.
  3. We’ll change the permissions in Okta and in the .env file.
  4. We’ll run the client again, and we’ll see how it’s able to perform all actions.

Create a Python virtual environment with the required libraries:

python3 -m venv .venv && source .venv/bin/activate 

pip install -r requirements.txt

In a first terminal run the Authorization Server:

source .venv/bin/activate
python -m uvicorn resource_as.server:app --port 9000

In a second terminal run the MCP Server:

source .venv/bin/activate
python -m mcp_server.server

And in a third one run the client:

source .venv/bin/activate
python -m client.run

Obtaining an ID Token

First, you will notice a browser tab opens for Okta sign-in. This represents steps 1-4 from the EMA flow:

Step 1: Login request

The client builds the authorization URL and opens a new browser tab with it, displaying the Okta login page. It generates a random PKCE and sends its SHA-256 as a challenge. The state field protects against forged callbacks.

def sign_in(okta: dict) -> dict:

    verifier = secrets.token_urlsafe(48)

    challenge = base64.urlsafe_b64encode(hashlib.sha256(verifier.encode()).digest()).rstrip(b"=").decode()

    state = secrets.token_urlsafe(16)

    params = {

        "client_id": OKTA_CLIENT_ID,

        "response_type": "code",

        "scope": "openid profile email offline_access",

        "redirect_uri": REDIRECT_URI,

        "state": state,

        "code_challenge": challenge,

        "code_challenge_method": "S256",

    }

...

Step 2: Receiving the auth code on the callback

After the user signs in, Okta redirects the browser to CLIENT_REDIRECT_URI (http://localhost:8080/callback), sending a one-time authorization code. The client receives it and checks that the state matches the one sent in the previous step.

server = http.server.HTTPServer((redirect.hostname, redirect.port or 80), Handler)

...

if result.get("state") != expected_state:

    raise SystemExit("state mismatch")

return result["code"]

Step 3-4: Requesting and receiving the ID Token

The client sends the authorization code to Okta’s endpoint, with no browser involved. It includes the PKCE verifier, which Okta validates and compares with the one sent in Step 1. 

Okta responds with an ID Token, which says who signed in. 

r = httpx.post(

    okta["token_endpoint"],

    data={

        "grant_type": "authorization_code",

        "code": code,

        "redirect_uri": REDIRECT_URI,

        "code_verifier": verifier,

        "client_id": OKTA_CLIENT_ID,

        "client_secret": OKTA_CLIENT_SECRET,

    },

)

tokens = r.json()   # id_token, access_token, refresh_token

In the console, you will see the format of the ID token received:

header:  {

  "kid": "Emsi_vfXs68ACT31HOwmTRMlmZvr8ceChwg63K9V4Go",

  "alg": "RS256"

}

payload: {

  "sub": "00u18d927x2LLfOvk498",

  "name": "John Doe",

  "email": "johndoe@company.com",

  "ver": 1,

  "iss": "https://integrator-6705972.okta.com",

  "aud": "0oa195ncjsv7sdFEM698",

  "iat": 1793743085,

  "exp": 1793746685,

  "jti": "ID.VpVX47kL_BhamOSzKIVxoGja-oWg3549iMkl0a8eVFM",

  "amr": [

    "mfa",

    "otp",

    "pwd",

    "okta_verify"

  ],

  "idp": "00o18d927sv0esXtE698",

  "preferred_username": "johndoe@company.com",

  "auth_time": 1793743084,

  "at_hash": "W8cjrdmOKcfr3whiO01v6Q"

}

Where its fields indicate:

  • iss: the issuer, who vouched for this token.
  • sub: your user ID in Okta.
  • aud: The ID for notes-requesting-app. This prevents this token from being used in other places.
  • iat and exp: the time the token was issued and the expiration date. These values indicate it’s valid for 1 hour.
  • amr: the methods you used to authenticate (multi-factor, password, etc.).
  • name, email, and preferred_username: profile data that identify you.

Obtaining and Exchanging an ID-JAG

Once the client has the ID Token, it will request an ID-JAG from Okta, in order to exchange it for an access token for the MCP Server.

Steps 5–6: Exchanging the token for an ID-JAG

The client asks Okta for an ID-JAG token using OAuth Token Exchange. Okta will check the authorization server that will redeem the grant, the resource (MCP server), and the scope it wants. It will query the notes-app AI agent to validate if the client + scope + resource + user is allowed to access this resource. 

If so, it will return an ID-JAG signed by Okta, addressed to the resource authorization server.

r = httpx.post(

    okta["token_endpoint"],

    data={

        "grant_type": "urn:ietf:params:oauth:grant-type:token-exchange",

        "requested_token_type": "urn:ietf:params:oauth:token-type:id-jag",

        "subject_token": tokens["refresh_token"],

        "subject_token_type": "urn:ietf:params:oauth:token-type:refresh_token",

        "audience": RESOURCE_AS_ISSUER,   # who will redeem it

        "resource": MCP_RESOURCE,         # what it is for

        "scope": SCOPES,

        "client_id": OKTA_CLIENT_ID,

        "client_secret": OKTA_CLIENT_SECRET,

    },

)

id_jag = r.json()["access_token"]   # the ID-JAG is returned in this field

In the console, you will see the format of the ID-JAG token:

header:  {

  "kid": "Emsi_vfXs68ACT31HOwmTRMlmZvr8ceChwg63K9V4Go",

  "typ": "oauth-id-jag+jwt",

  "alg": "RS256"

}

payload: {

  "jti": "IDAAG.Dlgpch6MgDjrMNganSsVPs2jGNz2Nh6laQOKX2laGl8",

  "iss": "https://integrator-6705972.okta.com",

  "aud": "https://fresh-flowers-dress.loca.lt",

  "iat": 1793743387,

  "exp": 1793743687,

  "sub": "00u18d927x2LLfOvk698",

  "email": "johndoe@company.com",

  "client_id": "demo-agent",

  "sub_profile": "user",

  "scope": "notes.read",

  "act": {

    "sub": "0oa195ncjsv7sdFEM698",

    "sub_profile": "ai_agent web_app"

  }

}

These are the most important fields:

  • aud: your resource authorization server.
  • iat and exp: the time the token was issued and the expiration date. These values indicate it’s valid for 5 minutes.
  • sub: same user as the ID Token.
  • scope: what the IdP approved this token for (notes.read).
  • client_id: same as the IA agent’s resource connection.

Steps 7-8: Getting the access token

The client presents the ID-JAG token to the authorization server, using the JWT bearer grant. The authorization server checks that the ID-JAG was signed by Okta and addressed to itself. If all is correct, it will issue a short-lived access token.

r = httpx.post(

    resource_as["token_endpoint"],

    auth=(RESOURCE_AS_CLIENT_ID, RESOURCE_AS_CLIENT_SECRET),

    data={

        "grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer",

        "assertion": id_jag,

        "scope": SCOPES,

    },

)

access_token = r.json()["access_token"]

Adjusting Scopes on the Authorization Server

Step 9: Accessing the MCP server with an access token.

The client will try to:

  • Read all the notes.
  • Add a note.
  • Read all the notes again.
  • Delete the created note.

The client successfully read the notes in our notepad. But adding and deleting failed because we lacked the notes.write scope.

list_notes({}) -> 

  add_note({"text": "XAA flow worked"}) -> DENIED: missing scope notes.write

  list_notes({}) -> 

  delete_all_notes({"confirm": true}) -> DENIED: missing scope notes.write

Go to the Okta Agent configured in Step 3 at Directory → AI Agents, and include the notes.write scope in the permissions allowed to notes-requesting-app:

In the .env file, modify RESOURCE_SCOPES to include notes.write:

RESOURCE_SCOPES=notes.read notes.write

Try running the client again:

list_notes({}) -> 

  add_note({"text": "XAA flow worked"}) -> added (1 notes)

  list_notes({}) -> XAA flow worked

  delete_all_notes({"confirm": true}) -> deleted 1 notes

This confirms that the scope change allowed these operations.

What is Outside of EMA and Cross-App Access

While EMA has an important mission in enterprise authorization for MCPs, it does not cover certain aspects.

Limited Policies

You are limited to the IDP’s policies. The standard does not specify which policies to use. When the IdP issues the ID-JAG token, it can be exchanged for an access token, which allows any call within its scopes, and nothing in EMA checks whether a specific tool call should be allowed.

No Required Agentic Identity

ID-JAG includes the user (sub) and the client registration (client_id). Nothing in that protocol verifies which agent inside that client is making the request. If one application runs several agents under one client ID, they all get identical tokens, and the resource can’t tell them apart. 

In our notepad application example, imagine that we have a desktop agent running two agents that connect to our notepad: a summarizer that only reads notes and an organizer that also adds them. Since they are bound to the same application, they share the same permissions and client ID. Companies that require accountability will need to know explicitly which agent was acting here.

Can’t Revoke Tokens Already Issued

IDP revocation doesn’t reach tokens already issued. If the user already claimed the access token, there’s nothing we can do from the IdP side to cancel its validity. Imagine in our notepad application, at 9:58 the client redeems an ID-JAG and gets an access token for five minutes. At 10:00, an admin deactivates that user in the IdP. Until 10:03, the agent can still call the add_note and delete_all_notes tools.

Conclusion

Enterprise-managed authorization serves a real purpose: it moves the decision about which AI clients may connect to which MCP servers into the Identity Provider, which already governs your company’s access.

But EMA makes that decision once, when it issues the ID-JAG. It doesn’t say which agent is acting; it doesn’t tie an action to what the user actually asked. And it can’t revoke tokens already issued.

Approving a connection is not the same as authorizing an action, and agents need both.

XAA, ID-JAG and EMA FAQ

What is XAA?

Cross-App Access (XAA) is Okta’s implementation of ID-JAG. It lets an application or AI agent request access to another application on a signed-in user’s behalf, subject to policies set in Okta.

What is ID-JAG?

Identity Assertion JWT Authorization Grant (ID-JAG) is a proposed OAuth 2.0 extension that lets a client use an existing enterprise sign-in to request access to another service. The identity provider issues a signed grant, which the client presents to the target service’s authorization server to obtain an access token.

What is EMA in MCP?

Enterprise-Managed Authorization (EMA) is a Model Context Protocol (MCP) extension that applies ID-JAG to MCP servers. It lets administrators manage which clients can connect to approved MCP servers through the company’s identity provider. Users can sign in once and connect to those servers without a separate consent prompt for each one.

Does EMA control which MCP tools an agent can call?

EMA governs access to the MCP server and can carry approved OAuth scopes. The MCP server or gateway must enforce what those scopes permit on each tool call. In the notes demo, the server allows list_notes with notes.read and requires notes.write for adding or deleting notes.

Can EMA distinguish between agents that share an MCP client?

ID-JAG identifies the user and the registered client. If two agents share a client registration, EMA alone gives the MCP server no way to tell which agent made a call. That requires a distinct identity for each agent that the server or gateway can verify.

What happens to existing access when an administrator revokes it at the identity provider?

The identity provider can stop issuing new grants. An access token already issued by the MCP server’s authorization server may still work until it expires, depending on how the service validates and revokes tokens. In the notes demo, an access token has a five-minute lifetime.

Related Reading

Víctor Jiménez
Víctor Jiménez

Víctor Jiménez is an engineer and technical writer who specializes in turning complex engineering concepts into clear, practical explanations. He began his career as a full-stack software engineer, while also working as a MySQL database administrator and certified instructor. After moving into technical marketing, Víctor focused increasingly on educational content for technical audiences. His recent work covers cloud infrastructure, containers and cybersecurity. Outside of work, he experiments with 3D printing, builds LEGO sets and hosts Dungeons & Dragons campaigns.

You might also like

Cyber Monday is going agentic. Here’s what retailers must verify when the shopper is an AI agent and how Aembit makes it possible.
AI agents are changing how identity and access work but most teams are unprepared.
Runnable security patterns that examine how agentic behavior expands, drifts, and exceeds intent during everyday use.