Guide to Authentication for the OpenAI Apps SDK (stytch.com)

🤖 AI Summary
OpenAI’s new Apps SDK (built on the Model Context Protocol) lets developers embed full apps inside ChatGPT with custom UI components, persistent user context, and direct API access. To keep these integrations secure and interoperable, OpenAI prescribes standard OAuth 2.1 + OIDC flows: ChatGPT acts as the OAuth public client, your backend is the protected resource, and an identity layer (either your own or a service like Stytch Connected Apps) handles client registration, consent, token issuance and refresh. The result: standards-based, extensible integrations (examples shown at DevDay included Coursera and Zillow) with built-in user-facing consent and write-action confirmations. Technically, the flow is familiar but adapted for MCP: ChatGPT discovers your endpoints via /.well-known/oauth-protected-resource, runs an Authorization Code + PKCE exchange, and sends access tokens in Authorization: Bearer headers to tool calls. Your MCP server remains the source of truth—validating JWTs (or introspecting tokens), enforcing scopes, and issuing WWW-Authenticate challenges to prompt reauthorization. OpenAI adds an MCP extension, securitySchemes, so each tool can declare noauth or oauth2 with explicit scopes (and even support preview behavior by allowing both). UI components run sandboxed (Skybridge) with CSP-declared domains, so privileged operations must go through MCP tool calls. FastMCP and RemoteAuthProvider examples show how to wire JWKS, issuer/audience checks, and automatic PRM endpoints, making adoption straightforward if your IdP already supports OAuth/OIDC.
Loading comments...
loading comments...