0Pricing
MCP Academy · Lekcja

Przepływ OAuth w MCP

Dowiedz się, jak klienci uzyskują tokeny dla chronionych serwerów.

Przepływ OAuth w MCP to bezpłatna lekcja MCP Academy na CoddyKit. To lekcja 3 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej MCP Academy, a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs MCP Academy zawiera 4 lekcji w sumie.

Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.

Why Static Tokens Fall Short

A single shared token works for one user, but real apps have many. OAuth gives each client its own token without handing out one master secret. 🔑

OAuth in One Sentence

OAuth lets a client obtain a short-lived access token by proving its identity, instead of you mailing secrets around by hand.

The Three Players

There is the client that wants access, the user who approves it, and the authorization server that issues the tokens.

MCP Servers Advertise Auth

A protected MCP server can tell clients where to authenticate by exposing its authorization server metadata. Clients read it to start the flow.

The Authorization Request

The client kicks things off by sending the user to the authorization server to log in and grant consent.

User Grants Consent

The user reviews what access is being asked for and approves. Nothing is issued until that consent step happens.

Exchanging the Code

The authorization server hands back a short authorization code, which the client swaps for a real access token.

POST /token
grant_type=authorization_code
code=AUTH_CODE_HERE

The Access Token Arrives

The token endpoint returns an access token. The client then sends it as a bearer token on every MCP request.

{
  "access_token": "eyJhbGci...",
  "token_type": "Bearer",
  "expires_in": 3600
}

Tokens Expire on Purpose

Access tokens are short-lived. When one expires, the client must refresh or re-authenticate rather than reuse it forever.

Refresh Without Re-Login

A refresh token lets the client get a fresh access token quietly, so the user is not prompted to log in every hour.

The Server Just Validates

Your MCP server does not run the login screen. It only validates the access token it receives on each incoming request.

Quick Check

Trace one step of the flow.

Recap: Earn the Token

OAuth turns "share a secret" into "earn a token": consent, exchange a code, get a short-lived access token, refresh as needed. 🔄

Często zadawane pytania

Czy lekcja „Przepływ OAuth w MCP” jest bezpłatna?

Tak — pełny tekst „Przepływ OAuth w MCP” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu MCP Academy, przejdź na CoddyKit PRO. Kurs MCP Academy zawiera 4 lekcji w sumie.

Co nauczysz się w „Przepływ OAuth w MCP”?

Dowiedz się, jak klienci uzyskują tokeny dla chronionych serwerów. Ćwiczysz MCP Academy z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.

Czy potrzebuję doświadczenia, aby zacząć MCP Academy?

Nie wymagamy żadnego doświadczenia. MCP Academy w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 3 z 4.

Ile czasu zajmuje lekcja „Przepływ OAuth w MCP”?

Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.

Czy mogę pisać i uruchamiać kod w tej lekcji MCP Academy?

Tak. Każda lekcja MCP Academy zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.

Wszystkie lekcje w tym kursie

  1. Dlaczego zdalne serwery potrzebują uwierzytelniania
  2. Tokeny Bearer i nagłówki
  3. Przepływ OAuth w MCP
  4. Ograniczanie możliwości tokenu
← Powrót do MCP Academy