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

ภาพรวมโฟลว์ OIDC

ทำความรู้จักโฟลว์ OIDC ต่าง ๆ ได้แก่ รหัสอนุญาตสิทธิ์ แบบแฝง และแบบผสม พร้อมเรียนรู้ว่าแต่ละแบบควรใช้เมื่อใด

ภาพรวมโฟลว์ OIDC เป็นบทเรียน OAuth2 & OpenID Connect Deep Dive ฟรีบน CoddyKit นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน OAuth2 & OpenID Connect Deep Dive และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส OAuth2 & OpenID Connect Deep Dive มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

Welcome to OIDC Flows!

In this lesson, we'll explore the main flows (or grant types) used in OpenID Connect (OIDC). These flows define how your application (the Client) interacts with an OpenID Provider (like Google or Auth0) to get identity information about a user.

OIDC builds directly on top of OAuth2, so these flows will look familiar if you've studied OAuth2 grant types.

OIDC's Foundation: OAuth2 Flows

Remember, OIDC is an identity layer built on OAuth2. This means it reuses OAuth2's authorization flows, but with a crucial addition: the ID Token.

  • ID Token: A JSON Web Token (JWT) containing information (claims) about the authenticated user.
  • The choice of flow determines how this ID Token (and an Access Token) is delivered to your client application.

1. Authorization Code Flow (OIDC)

This is the most secure and recommended flow for OIDC, especially for web applications with a backend (confidential clients).

  • How it works: The client exchanges an authorization code for tokens (ID Token and Access Token) directly with the OpenID Provider's token endpoint.
  • This exchange happens over a secure, server-to-server (back-channel) connection.

Auth Code Flow: Why it's Best

The Authorization Code Flow is preferred because the tokens are never exposed in the user's browser or URL.

  • Security: Tokens are exchanged directly between servers, reducing the risk of interception.
  • Client Type: Ideal for web applications with a backend.
  • PKCE: Often paired with Proof Key for Code Exchange (PKCE) for public clients (like mobile apps) to prevent code interception.

2. Implicit Flow (OIDC)

The Implicit Flow delivers tokens directly to the client via the browser's URL fragment after user authentication. It was historically used for single-page applications (SPAs).

Important: Due to security concerns (like token leakage via browser history or referrer headers), the Implicit Flow is largely deprecated by the OAuth2.0 and OIDC specifications.

Implicit Flow: Deprecated, Why?

While simpler to implement for browser-based apps, its security drawbacks are significant:

  • No Code Exchange: Tokens are granted directly, without a secure back-channel exchange.
  • Front-Channel Exposure: Tokens appear in the browser's URL, making them vulnerable.
  • No Refresh Tokens: Typically, this flow doesn't issue refresh tokens, requiring re-authentication.

Modern SPAs should use the Authorization Code Flow with PKCE instead.

3. Hybrid Flow (OIDC)

The Hybrid Flow combines elements of both the Authorization Code and Implicit flows. It allows the client to receive some tokens via the front-channel (browser) and others via the back-channel (server-to-server).

  • For example, an ID Token might be returned directly in the URL, while an Access Token is obtained via a code exchange.

Hybrid Flow: Flexibility & Trade-offs

This flow offers flexibility but comes with increased complexity and potential security trade-offs, depending on what tokens are delivered via the front-channel.

  • Use Cases: Can be used when a client needs immediate access to an ID Token (e.g., for UI updates) but wants to fetch the Access Token more securely.
  • Considerations: Carefully weigh the security implications of any tokens returned directly to the browser.

Choosing the Right OIDC Flow

When selecting an OIDC flow for your application, always prioritize security:

  • Web Apps (Confidential Clients): Use Authorization Code Flow with PKCE.
  • Mobile/Desktop Apps (Public Clients): Use Authorization Code Flow with PKCE.
  • SPAs (Public Clients): Use Authorization Code Flow with PKCE.
  • Implicit Flow: Avoid using it for new applications due to security risks.
  • Hybrid Flow: Use with caution and a clear understanding of its security implications.

Flows Quick Check

Which of the following statements about OpenID Connect (OIDC) flows are TRUE?

OIDC Flows: Recap & Next Steps

You've now got an overview of the primary OIDC flows:

  • Authorization Code Flow: The most secure, recommended for most applications, especially with PKCE.
  • Implicit Flow: Largely deprecated due to security concerns.
  • Hybrid Flow: A flexible but more complex option combining elements of both.

Understanding these flows is crucial for implementing secure identity solutions. Next, we'll dive deeper into implementing specific OIDC flows.

คำถามที่พบบ่อย

บทเรียน “ภาพรวมโฟลว์ OIDC” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “ภาพรวมโฟลว์ OIDC” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส OAuth2 & OpenID Connect Deep Dive ให้อัปเกรดเป็น CoddyKit PRO คอร์ส OAuth2 & OpenID Connect Deep Dive มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “ภาพรวมโฟลว์ OIDC”

ทำความรู้จักโฟลว์ OIDC ต่าง ๆ ได้แก่ รหัสอนุญาตสิทธิ์ แบบแฝง และแบบผสม พร้อมเรียนรู้ว่าแต่ละแบบควรใช้เมื่อใด คุณปฏิบัติ OAuth2 & OpenID Connect Deep Dive ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน OAuth2 & OpenID Connect Deep Dive หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน OAuth2 & OpenID Connect Deep Dive บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน

บทเรียน “ภาพรวมโฟลว์ OIDC” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน OAuth2 & OpenID Connect Deep Dive นี้ได้ไหม

ได้ บทเรียน OAuth2 & OpenID Connect Deep Dive ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. OIDC: ชั้นอัตลักษณ์บน OAuth2
  2. โทเค็น ID และข้ออ้างสิทธิ์
  3. ภาพรวมโฟลว์ OIDC
  4. จุดปลายทาง UserInfo
← กลับไปที่ OAuth2 & OpenID Connect Deep Dive