40% off first 3 months: code LAUNCH40 (ends Dec 31).See Pricing

Agent Optimization7 min read

Agent auth: OAuth + PKCE

PromptEden supports OAuth 2.1 authorization code with S256 PKCE for agent connectors. Connectors can register themselves through dynamic client registration or use a client ID metadata document. The local stdio MCP server uses API keys, not OAuth tokens.

By PromptEden Team
Agent auth: OAuth + PKCE

Prerequisites

Your connector needs a client_id. Get one in either of these ways:

  • Register the client at https://app.prompteden.com/oauth/register (dynamic client registration).
  • Use a client ID metadata document. The metadata advertises client_id_metadata_document_supported: true.

Your connector must generate a PKCE code_verifier and S256 code_challenge for each authorization attempt.

Claude.ai, Claude Desktop, ChatGPT and other remote MCP clients do this for you. Point them at https://app.prompteden.com/api/mcp and approve OAuth in the browser. See MCP connection docs.

Discovery URLs

PromptEden publishes OAuth metadata here:

GET https://app.prompteden.com/.well-known/oauth-authorization-server

The metadata advertises:

  • authorization_endpoint: https://app.prompteden.com/oauth/authorize
  • token_endpoint: https://app.prompteden.com/oauth/token
  • registration_endpoint: https://app.prompteden.com/oauth/register
  • client_id_metadata_document_supported: true
  • response_types_supported: code
  • grant_types_supported: authorization_code, refresh_token
  • code_challenge_methods_supported: S256
  • token_endpoint_auth_methods_supported: none
  • scopes_supported: account:read, projects:read, monitors:read, results:read, providers:read, displacement:read, analytics:read, content:read, content:write

Authorization request

Send the user to PromptEden's authorization endpoint:

GET https://app.prompteden.com/oauth/authorize?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REGISTERED_REDIRECT_URI&code_challenge=BASE64URL_SHA256_VERIFIER&code_challenge_method=S256&state=OPAQUE_STATE&scope=account:read%20projects:read%20monitors:read

PromptEden requires:

  • response_type=code
  • A registered client_id
  • A redirect_uri registered for that client
  • code_challenge_method=S256
  • A valid code_challenge
  • state
  • Scopes from scopes_supported that the client is allowed

Token exchange

Exchange the code for tokens at /oauth/token. PromptEden treats these as public PKCE clients: do not send HTTP Basic auth and do not send client_secret.

curl -X POST https://app.prompteden.com/oauth/token \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'grant_type=authorization_code' \
  --data-urlencode 'client_id=YOUR_CLIENT_ID' \
  --data-urlencode 'code=RETURNED_CODE' \
  --data-urlencode 'redirect_uri=YOUR_REGISTERED_REDIRECT_URI' \
  --data-urlencode 'code_verifier=ORIGINAL_CODE_VERIFIER'

The access token uses PromptEden's OAuth token prefix and can be sent as:

Authorization: Bearer poa_...

Refresh tokens are supported with grant_type=refresh_token.

Using OAuth tokens with REST

Send the OAuth access token as a bearer token on REST routes:

curl https://app.prompteden.com/api/v1/monitors \
  -H "Authorization: Bearer poa_..."

OAuth tokens may call raw REST routes only for read-scoped operations. Use an API key for direct REST writes. The local stdio MCP server also reads an API key from PROMPTEDEN_API_KEY, not an OAuth token.

Hosted MCP runs over Streamable HTTP at https://app.prompteden.com/api/mcp. It accepts OAuth tokens or an API key sent as Authorization: Bearer pe_.... See MCP connection docs for setup and hosted write limits.

The downloadable stdio server is version 0.6.0. It lists 26 public tools. Content tools and the nine content-agent tools appear only after discovery, when content or content agents are enabled for the team. Content reads and writes run through hosted MCP, including from local stdio. Every content write returns an approval_required proposal with a browser link for an owner/admin decision. Content reads require content:read; writes require content:write. With an API key, hosted create_monitor, run_monitor, and analytics_add_property_host also return approval proposals with a deepLinkUrl; poll check_approval until a person decides. Other writes in the MCP guide are disabled on hosted MCP.

Troubleshooting

unauthorized_client. The client_id is missing, disabled, or unknown.

invalid_request: redirect_uri is not allowed. The redirect URI does not exactly match one registered for the client.

invalid_request: PKCE code_challenge_method must be S256. Plain PKCE is not supported.

invalid_scope. The requested scope is not in the client's allowed scope list.

invalid_token. The access token is invalid or expired.

403 plan_limit. The authorized workspace does not have API access.

403 insufficient_scope. The OAuth token is valid but missing a scope required by the REST route.

403 oauth_write_not_allowed. Raw REST writes with OAuth tokens are blocked. Use an API key: with hosted MCP to propose create_monitor, run_monitor, or analytics_add_property_host for owner or admin review at the returned deepLinkUrl, or with the local stdio server for other write tools. See MCP connection docs for permissions and limits.

oauthpkcemcpagent-auth

Frequently asked questions

Can my agent dynamically register an OAuth client?

Yes. Register it at https://app.prompteden.com/oauth/register, or use a client ID metadata document. Clients are public PKCE clients with no client secret.

Does PromptEden accept client_secret at the token endpoint?

No. The token endpoint is for public PKCE clients. Send client_id, code, redirect_uri, and code_verifier, but do not send client_secret or HTTP Basic auth.

Can OAuth tokens make changes through REST?

Raw REST writes with OAuth connector tokens are blocked. Use an API key for direct REST writes and for hosted create_monitor, run_monitor, and analytics_add_property_host proposals. See /docs/mcp/ for hosted write limits.

What scopes are available?

The OAuth server supports account:read, projects:read, monitors:read, results:read, providers:read, displacement:read, analytics:read, content:read, and content:write.

Connect an agent with OAuth

Use OAuth + PKCE for remote MCP clients. Use an API key for REST writes and for hosted monitor and analytics write proposals.