CodeGym
AI Academy
Promotion
CodeGym University
Learning
Courses
Tasks
Surveys & Quizzes
Games
Help
Schedule
Community
Users
Forum
Chat
Articles
Success stories
Activity
Reviews
Subscriptions
Light theme

Lessons

  • Reviews
  • About us
Start
Start learning
Start learning now
  • My Progress
  • Courses
  • University
  • Quest Map
  • Lessons
  • Why authentication is needed in a ChatGPT App and a brief evolution of OAuth

    ChatGPT Apps
    Level 10, Lesson 0
    We explain why a user in ChatGPT is not the same as a user in your service, why a full OAuth sign-in is needed for the ChatGPT App and the MCP server, how AuthN differs from AuthZ, why the “one API key in .env” approach breaks personalization and security, and how the modern OAuth 2.1 standard with PKCE (S256) fits the MCP model: tokens, scopes, aud validation, and challenges via _meta [ "mcp/www_authenticate" ].
    Available
  • Architecture of MCP authorization: MCP Client, MCP Server, MCP Auth Server

    ChatGPT Apps
    Level 10, Lesson 1
    In this lecture we assemble in our heads the “triangle of trust” among MCP Client (ChatGPT/Apps SDK), MCP Server (your resource server with tools), and MCP Auth Server (Keycloak/Auth0, etc.). We unpack the full OAuth flow: from 401 and WWW-Authenticate to the Bearer token, PKCE, and protected MCP tool calls; we also show how claims ( sub, aud, scope) turn into the userId in your database via an identity bridge.
    Available
  • Setting Up an MCP Auth Server: the Keycloak example

    ChatGPT Apps
    Level 10, Lesson 2
    In this lecture, using a practical Keycloak example, we assemble OAuth/OIDC authentication for an MCP scenario: we will unpack the roles of ChatGPT / MCP Jam (public client), your MCP server (resource server), and Keycloak (auth server), set up a separate realm for the application, create a public client with Authorization Code + PKCE ( S256), carefully configure the redirect URI, minimal scopes (for example, openid and mcp:tools), and also discuss tokens, claims, JWKS, and common integration pitfalls.
    Available
  • Configuring MCP Server as a protected resource: .well-known, Bearer, audience/scope

    ChatGPT Apps
    Level 10, Lesson 3
    We break down how to turn an MCP server into an OAuth 2.1 Resource Server: publish metadata via /.well-known/oauth-protected-resource (RFC 9728), respond properly with 401 and WWW-Authenticate: Bearer, verify JWT locally (signature, iss, aud, exp), extract sub and scope, and pass a “ready” user context into the MCP SDK. Implementation shown with Next.js 16 and TypeScript (Route Handlers + jose).
    Available
  • Testing login and access via MCP Jam: None, Bearer, OAuth with credentials, Default OAuth

    ChatGPT Apps
    Level 10, Lesson 4
    In this lecture you will explore MCP Jam as a “lab” for debugging authorization of an MCP server: how the modes None, Bearer, OAuth with credentials, and Default OAuth differ; what exactly Jam sends in requests (for example, the Authorization header); how to read 401/ 403 responses; why WWW-Authenticate with resource_metadata is critical; and how to diagnose breakages between the MCP Server, the Auth Server, and the /.well-known/oauth-protected-resource document.
    Available
Learn
  • Registration
  • Java Course
  • Help with Tasks
  • Pricing
  • Java Syntax
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success Stories
  • Activity
  • Affiliate Program
Company
  • About us
  • Contacts
  • Reviews
  • Press Room
  • CodeGym for EDU
  • FAQ
  • Support
CodeGym CodeGym is an online course for learning Java programming from scratch. This course is a perfect way to master Java for beginners. It contains 1200+ tasks with instant verification and an essential scope of Java fundamentals theory. To help you succeed in education, we’ve implemented a set of motivational features: quizzes, coding projects, content about efficient learning, and a Java developer’s career.
Follow us
Interface language
English
Deutsch Español हिन्दी Français Português Polski বাংলা 简体中文 मराठी தமிழ் Italiano Bahasa Indonesia 繁體中文 Nederlands 日本語 한국어 Bulgarian Danish Hungarian Basa Jawa Malay Norwegian Romanian Swedish Telugu Thai Українська Filipino Turkish Azərbaycan Русский Vietnamese
Programmers Are Made, Not Born © 2026 CodeGym
MastercardVisa
Programmers Are Made, Not Born © 2026 CodeGym