0Pricing
OAuth2 & OpenID Connect Deep Dive · Урок

Конечная точка обнаружения OIDC

Узнайте, как конечная точка обнаружения OIDC позволяет клиентам программно получать всю необходимую информацию о конфигурации OIDC.

«Конечная точка обнаружения OIDC» — бесплатный урок OAuth2 & OpenID Connect Deep Dive на CoddyKit. Это урок 2 из 4. Ты можешь прочитать весь урок бесплатно ниже — а потом практиковать его прямо в браузере с встроенным редактором кода и ИИ-репетитором 24/7. Это часть пути обучения OAuth2 & OpenID Connect Deep Dive, и твой прогресс синхронизируется между веб-версией и приложением CoddyKit. Курс OAuth2 & OpenID Connect Deep Dive содержит 4 уроков всего.

Части этого урока еще не переведены и отображаются на английском.

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 the iss claim 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.0 scope values that this IdP supports.
  • response_types_supported: A list of the OAuth 2.0 response_type values that this IdP supports.
  • grant_types_supported: (Optional) A list of the OAuth 2.0 grant_type values 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:

  1. Fetching the JSON document from the /.well-known/openid-configuration endpoint.
  2. Parsing the JSON to extract the necessary URLs and capabilities.
  3. 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_uri to 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-configuration endpoint.
  • 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.

Часто задаваемые вопросы

Урок «Конечная точка обнаружения OIDC» бесплатный?

Да — полный текст урока «Конечная точка обнаружения OIDC» бесплатно доступен здесь в веб-версии. Чтобы практиковать его интерактивно (встроенный редактор кода и ИИ-репетитор 24/7) и разблокировать остальной курс OAuth2 & OpenID Connect Deep Dive, подпишись на CoddyKit PRO. Курс OAuth2 & OpenID Connect Deep Dive содержит 4 уроков всего.

Чему я научусь в уроке «Конечная точка обнаружения OIDC»?

Узнайте, как конечная точка обнаружения OIDC позволяет клиентам программно получать всю необходимую информацию о конфигурации OIDC. Ты практикуешь OAuth2 & OpenID Connect Deep Dive с помощью реального кода, который запускаешь прямо в браузере, и ИИ-репетитор 24/7 отвечает на твои вопросы во время урока.

Нужен ли мне опыт, чтобы начать OAuth2 & OpenID Connect Deep Dive?

Предыдущий опыт не требуется. OAuth2 & OpenID Connect Deep Dive на CoddyKit структурирован для всех уровней — от новичков до продвинутых, поэтому ты можешь начать отсюда или с самого начала и учиться в своем темпе. Это урок 2 из 4.

Сколько времени занимает урок «Конечная точка обнаружения OIDC»?

Большинство уроков CoddyKit занимают около 5–10 минут. Каждый из них компактный и интерактивный, поэтому ты постоянно делаешь прогресс и продолжаешь с того же места в веб-версии и приложении.

Можно ли писать и запускать код в этом уроке OAuth2 & OpenID Connect Deep Dive?

Да. Каждый урок OAuth2 & OpenID Connect Deep Dive включает встроенный редактор кода, поэтому ты пишешь и запускаешь реальный код прямо в браузере и получаешь моментальную обратную связь от AI — локальная установка не требуется.

Все уроки этого курса

  1. Динамическая регистрация клиентов
  2. Конечная точка обнаружения OIDC
  3. Управление сеансами
  4. Запрос утверждений и агрегированные утверждения
← Назад к OAuth2 & OpenID Connect Deep Dive