0Pricing
OAuth2 & OpenID Connect Deep Dive · บทเรียน

ปลายทางการค้นหา OIDC

เรียนรู้ว่าปลายทางการค้นหา OIDC ช่วยให้ไคลเอ็นต์เรียกข้อมูลการตั้งค่า OIDC ที่จำเป็นทั้งหมดโดยอัตโนมัติได้อย่างไร

ปลายทางการค้นหา OIDC เป็นบทเรียน OAuth2 & OpenID Connect Deep Dive ฟรีบน CoddyKit นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 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” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส OAuth2 & OpenID Connect Deep Dive ให้อัปเกรดเป็น CoddyKit PRO คอร์ส OAuth2 & OpenID Connect Deep Dive มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “ปลายทางการค้นหา OIDC”

เรียนรู้ว่าปลายทางการค้นหา OIDC ช่วยให้ไคลเอ็นต์เรียกข้อมูลการตั้งค่า OIDC ที่จำเป็นทั้งหมดโดยอัตโนมัติได้อย่างไร คุณปฏิบัติ OAuth2 & OpenID Connect Deep Dive ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 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. คำขอ Claims และ Claims แบบรวม
← กลับไปที่ OAuth2 & OpenID Connect Deep Dive