Punkt końcowy OIDC Discovery
Nauczą się Państwo, jak punkt końcowy OIDC Discovery umożliwia klientom programowe pobieranie wszystkich niezbędnych informacji konfiguracyjnych OIDC.
Punkt końcowy OIDC Discovery to bezpłatna lekcja OAuth2 & OpenID Connect Deep Dive na CoddyKit. To lekcja 2 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 OAuth2 & OpenID Connect Deep Dive, a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs OAuth2 & OpenID Connect Deep Dive zawiera 4 lekcji w sumie.
Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.
What is OIDC Discovery?
Imagine you're building an application that needs to connect to an OpenID Provider (IdP) like Google or Auth0. How do you know its authorization URL, token URL, or how to get its public keys?
Manually configuring these details for every IdP is tedious and error-prone. This is where OIDC Discovery comes in!
The Discovery Endpoint
OIDC Discovery provides a standardized way for clients to find all the necessary configuration information of an OpenID Provider.
Instead of hardcoding URLs, your client application can fetch a single JSON document from a well-known URL. This document contains all the endpoints and capabilities of the IdP.
Finding the Discovery Document
Clients typically access the OIDC Discovery document at a specific, standardized URL:
- Base URL of the OpenID Provider
- Followed by
/.well-known/openid-configuration
For example, if your IdP's base URL is https://accounts.example.com, the discovery endpoint would be https://accounts.example.com/.well-known/openid-configuration.
Key Fields: Issuer & JWKS URI
The discovery document is a JSON object with many fields. Two crucial ones are:
issuer: A URL that uniquely identifies the OpenID Provider. It must match theissclaim in ID Tokens.jwks_uri: The URL of the JSON Web Key Set (JWKS) document. This document contains the public keys used by the IdP to sign ID Tokens, allowing your client to verify their authenticity.
Key Fields: Endpoints
The discovery document lists the various endpoints your client will interact with:
authorization_endpoint: Where the user is redirected to grant consent.token_endpoint: Where the client exchanges the authorization code for access and ID tokens.userinfo_endpoint: Where the client can request user profile information after obtaining an access token.end_session_endpoint: (Optional) Where the client can redirect the user to log out from the IdP.
Key Fields: Capabilities
The document also declares the IdP's capabilities:
scopes_supported: A list of the OAuth 2.0scopevalues that this IdP supports.response_types_supported: A list of the OAuth 2.0response_typevalues that this IdP supports.grant_types_supported: (Optional) A list of the OAuth 2.0grant_typevalues that this IdP supports.
These help your client understand what features are available.
Example Discovery Document
Here's a simplified example of what an OIDC Discovery document might look like:
{
"issuer": "https://example.com/openid",
"authorization_endpoint": "https://example.com/openid/auth",
"token_endpoint": "https://example.com/openid/token",
"userinfo_endpoint": "https://example.com/openid/userinfo",
"jwks_uri": "https://example.com/openid/jwks",
"scopes_supported": [
"openid",
"profile",
"email"
],
"response_types_supported": [
"code",
"id_token",
"token id_token"
],
"grant_types_supported": [
"authorization_code",
"implicit",
"refresh_token"
],
"id_token_signing_alg_values_supported": [
"RS256"
]
}How Clients Use Discovery
A client application can perform OIDC Discovery by:
- Fetching the JSON document from the
/.well-known/openid-configurationendpoint. - Parsing the JSON to extract the necessary URLs and capabilities.
- Using these dynamically discovered values to construct authorization requests, exchange tokens, and validate ID Tokens.
This makes client integration much more robust and future-proof.
Benefits of Discovery
Using OIDC Discovery offers several advantages:
- Reduced Configuration: Clients don't need to hardcode IdP endpoints.
- Increased Flexibility: IdPs can change endpoint URLs without breaking clients.
- Enhanced Security: Clients can easily find the
jwks_urito verify ID Token signatures. - Interoperability: Promotes a standardized way for clients to interact with any OIDC-compliant IdP.
Test Your Knowledge
Which of the following fields in the OIDC Discovery document is used by a client to verify the signature of an ID Token?
Recap: OIDC Discovery
We've learned that OIDC Discovery provides a standardized way for clients to find an OpenID Provider's configuration.
- Clients access a well-known
/.well-known/openid-configurationendpoint. - The returned JSON document contains essential URLs (authorization, token, userinfo, jwks) and capabilities (scopes, response types).
- This automation simplifies client setup, improves flexibility, and enhances security by providing necessary public keys for token validation.
Ucz się OAuth2 & OpenID Connect Deep Dive dzięki korepetycjom AI — za darmo
Pisz i uruchamiaj kod w przeglądarce, otrzymuj natychmiastową pomoc od korepetytora AI dostępnego 24/7 i kontynuuj naukę w sieci lub w aplikacji.
- Kursy
- 12
- Lekcje
- 48
Często zadawane pytania
Czy lekcja „Punkt końcowy OIDC Discovery” jest bezpłatna?
Tak — pełny tekst „Punkt końcowy OIDC Discovery” 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 OAuth2 & OpenID Connect Deep Dive, przejdź na CoddyKit PRO. Kurs OAuth2 & OpenID Connect Deep Dive zawiera 4 lekcji w sumie.
Co nauczysz się w „Punkt końcowy OIDC Discovery”?
Nauczą się Państwo, jak punkt końcowy OIDC Discovery umożliwia klientom programowe pobieranie wszystkich niezbędnych informacji konfiguracyjnych OIDC. Ćwiczysz OAuth2 & OpenID Connect Deep Dive 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ąć OAuth2 & OpenID Connect Deep Dive?
Nie wymagamy żadnego doświadczenia. OAuth2 & OpenID Connect Deep Dive 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 2 z 4.
Ile czasu zajmuje lekcja „Punkt końcowy OIDC Discovery”?
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 OAuth2 & OpenID Connect Deep Dive?
Tak. Każda lekcja OAuth2 & OpenID Connect Deep Dive 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
- Dynamiczna rejestracja klienta
- Punkt końcowy OIDC Discovery
- Zarządzanie sesją
- Żądanie claims i zagregowane claims