- Validate bearer tokens — an LLM or MCP application whose callers already hold an Okta access token (a service using client credentials, or an app forwarding a user token). TrustGate verifies the token and admits the caller; routing is the application’s own.
- OAuth2 · MCP login — an MCP application gated by a custom scope. Interactive agents (Cursor, Claude Desktop, MCP Inspector) use TrustGate’s authorization-code broker; optional client-credentials tokens are only for curl checks.
/oauth2/{authServerId}
path). The default custom auth server ships in every Okta org, including the free
Integrator Free Plan org — ideal for a POC. In production Workforce orgs the custom
authorization server feature is the API Access Management product.
Prerequisites
- An Okta org — note your domain, e.g.
dev-123456.okta.com. - Admin access to Security → API and Applications.
- For Cursor / agent MCP login: the public MCP base URL of your gateway (e.g.
https://default-xxxxxxxx.mcp.neuraltrust.ai), so you can register the OAuth redirect URI.
mcp_base_url: SaaS uses {slug}.mcp.neuraltrust.ai. Private/Hybrid uses the Dataplane MCP URL from Settings → General. Register {mcp_base_url}/oauth/callback on the IdP before testing agent login.
The values you will collect
1. Authorization server
All steps happen in the Okta Admin Console athttps://<your-org>-admin.okta.com
(the admin console, not the end-user dashboard). Use the left sidebar to navigate.
1
Open the authorization servers list
In the left sidebar go to Security → API, then open the Authorization Servers
tab.
2
Pick or create the server
Use the row named
default, or click Add Authorization Server (top right) and
fill:- Name:
trustgate - Audience:
api://trustgate - Description: anything.
3
Record the issuer and audience
Open the server and read the Settings tab. Copy the Issuer URI
(
https://{okta_domain}/oauth2/{okta_auth_server_id}) and the Audience — you will
paste both into the TrustGate trust anchor. The keys endpoint is the issuer plus
/v1/keys:2. Add a custom scope (for MCP)
Stay in Security → API → Authorization Servers → your server; the tabs below are on that server’s detail page.1
Create the scope
Open the Scopes tab → click Add Scope:
- Name:
mcp.access - Display phrase:
MCP access - Tick Include in public metadata.
2
Add an access policy
Open the Access Policies tab → click Add Policy:
- Name:
trustgate - Assign to clients: All clients (or select your app once it exists).
3
Add a rule to the policy
On the policy you just created click Add Rule:
- Rule name:
mcp - Grant type: tick Authorization Code (required for Cursor and other interactive MCP clients). Also tick Client Credentials if you want curl / M2M test tokens from the same app.
- Scopes requested: Any scopes (or The following scopes →
mcp.access).
3. Validate Okta bearer tokens (LLM or MCP)
Use this when the application already obtains its own Okta access token — client credentials for a service, or a user token the application forwards — and sends it asAuthorization: Bearer <token>. TrustGate verifies the token; what the application
binds on General decides providers and models. Everything below is done in the
NeuralTrust app — no API payloads.
1
Create the trust anchor
Go to Settings → Agent Gateway → Machine identity → Add trust anchor.
- Kind: IdP (JWT)
- Name: e.g.
okta-idp - Issuer:
https://{okta_domain}/oauth2/{okta_auth_server_id}
(example:https://dev-123456.okta.com/oauth2/default) - Audience: the authorization server audience (example:
api://default) - Advanced (optional): pin JWKS URL to
https://{okta_domain}/oauth2/{okta_auth_server_id}/v1/keys, restrict Allowed algorithms, set Required scopes, or change Subject claim fromsub.
2
Attach it to the application
Go to Agent Gateway → Applications, open (or create) the application, and on General →
Authentication choose Identity provider and select
okta-idp.- Allowed client IDs: the Okta Client ID of every application that may call
this application. TrustGate matches the token’s
azpclaim, elseclient_id. Okta access tokens carry the client id ascid, which TrustGate does not read — to use this list, add a custom claim on the authorization server (Claims → Add Claim: nameclient_id, include in Access Token, value type Expression, valueaccess.clientId). Leave the list empty only when the audience is dedicated to this one application.
3
Call the application
Mint a token from Okta (see §5) and send it:
401 means the token failed verification; 403 means it verified but its client id is
not in Allowed client IDs.4. OAuth2 for MCP
Use this when Cursor (or another MCP client) should log in through Okta. Access is gated by the custom scope from step 2 (for examplemcp.access).
How interactive MCP login works
Agents such as Cursor do not call Okta with client credentials. They talk to TrustGate’s MCP OAuth facade (authorization code + PKCE):- The agent discovers TrustGate as the authorization server
(
/.well-known/oauth-protected-resource— often path-scoped to/{application-slug}/mcp— and/.well-known/oauth-authorization-server). - It opens TrustGate
/oauth/authorize. - TrustGate redirects the browser to Okta’s authorize endpoint using the Web app
Client ID from your OAuth2 auth, with
redirect_uri={mcp_base_url}/oauth/callback(host root — not under the application path). - After the user signs in, Okta returns to TrustGate
/oauth/callback; TrustGate finishes the agent handshake. - If the virtual MCP has upstream providers (Notion, Linear, …), TrustGate may show a
Connect your accounts page at
/{application-slug}/mcp/connectafter Okta succeeds — that is a separate consent detour, not a substitute for Okta login.
1
Create an OIDC Web Application in Okta
In the Okta Admin Console go to Applications → Applications → Create App
Integration:
- Sign-in method: OIDC - OpenID Connect
- Application type: Web Application → Next
-
App integration name:
trustgate-mcp - Grant types: tick Authorization Code (required). Optionally tick Refresh Token, and Client Credentials if you also want curl M2M tests from this same app.
-
Sign-in redirect URIs: add exactly
Example:Match character-for-character (scheme, host, path
/oauth/callback, no trailing slash). - Controlled access: assign the users or groups that should be able to connect (or allow everyone in the org for a POC).
mcp.access scope for this client.2
Create the interactive OAuth2 auth
The Machine identity form creates token-validation anchors; an anchor that brokers
a login is created with the Admin API and is then
listed and editable under Settings → Agent Gateway → Machine identity:This is the Interactive login · IdP with discovery setup: leave
session_mode off
(Okta issues JWTs; session mode is for opaque-token IdPs such as GitHub) and do not add
openid / profile / email to required_scopes. jwks_url is optional — TrustGate
resolves keys from the issuer.3
Create an MCP application and attach the auth
Go to Agent Gateway → Applications → New Application.
- Name: e.g.
okta-mcp - Protocol:
MCP - Authentication → Identity provider: select
okta-mcp - Allowed client IDs (optional): the Web app’s Client ID
4
Connect from Cursor
Open the application → Connect tab. Copy the Cursor snippet (URL only — no API key):Add it as an MCP server in Cursor and start authentication. You should land on Okta
(login or an existing SSO session), then optionally TrustGate Connect your
accounts, then return to Cursor.After you change the Okta Client ID on the auth, confirm the next browser authorize
URL’s
client_id= matches the Web app — a stale API Services client id means the
auth was not saved or the agent is still using an old server config.5. Get a test token (optional M2M)
Client credentials are not what Cursor uses. Use this to decode a token and confirm issuer, audience, and scopes, or as the token a service sends in §3. The Okta app must allow the Client Credentials grant on the access-policy rule (and on the Web app if you enabled that grant type).access_token and confirm:
iss=https://dev-123456.okta.com/oauth2/defaultaud=api://defaultscp=["mcp.access"]client_id(the custom claim from §3, if you use Allowed client IDs) = the Client ID you listed
6. Force Okta login again (clear session)
If the browser skips the Okta UI and jumps straight to TrustGate’s connect page, you already had an Okta SSO cookie. To see login again:- Sign out at
https://{okta_domain}, or use a private / incognito window. - Clear site data for
{okta_domain}(and optionally{mcp_base_url}if a connect ticket is stuck). - In Admin → Directory → People → your user, clear active sessions if available.
- Retry MCP auth from the agent.
Troubleshooting
Next: Entra ID.