0Pricing
Spring Security 6 & JWT Authentication · บทเรียน

ภาพรวมโพรโทคอล OAuth2

เรียนรู้แนวคิดหลักของ OAuth2 บทบาทต่าง ๆ (ไคลเอ็นต์ เจ้าของทรัพยากร เซิร์ฟเวอร์การอนุญาต) และจุดประสงค์ของโพรโทคอลนี้

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

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

What is OAuth2?

Welcome to OAuth2! It's a widely used open standard for delegated authorization. This means it allows an application to access resources on behalf of a user without needing their actual credentials.

Think of it as giving a valet key to a parking attendant, instead of your master key. They can park your car, but can't open your house.

Authorization, Not Authentication

This is a crucial distinction! OAuth2 is primarily about authorization, not authentication.

  • Authentication: Verifying who you are (e.g., logging in with username/password).
  • Authorization: What you are allowed to do (e.g., access your photos).

OAuth2 helps you grant permission for an app to do things on your behalf, without telling the app who you are.

The Problem OAuth2 Solves

Imagine you want a photo printing service to access your pictures from Google Photos. Before OAuth2, you might have had to give the printing service your Google username and password.

This is risky! The service could then access your emails, documents, and anything else tied to your Google account. OAuth2 solves this by providing a secure way to grant limited access.

Role 1: Resource Owner

The Resource Owner is the person who owns the protected resources.

This is usually you, the end-user. You own your photos, your contacts, your profile information, etc., stored on various services.

You grant permission for applications to access these resources.

Role 2: Client Application

The Client Application (or just 'Client') is the application that wants to access your protected resources.

This could be a mobile app, a web application, or even a desktop program. Examples include the photo printing service or a social media manager.

It needs your permission to do anything.

Role 3: Resource Server

The Resource Server is where your protected resources actually live. It's the server that hosts the APIs for your data.

For example, if you're accessing Google Photos, the Google Photos API is the Resource Server. It protects your data and only allows access with valid tokens.

Role 4: Authorization Server

The Authorization Server is the heart of OAuth2. It's responsible for authenticating the Resource Owner and issuing access tokens.

When you grant permission, you're interacting with the Authorization Server. It then issues a special token to the Client, which the Client uses to talk to the Resource Server.

The Core Idea: Access Tokens

Instead of sharing your password, the Client Application receives an Access Token from the Authorization Server.

  • This token is like a temporary, permission-specific key.
  • It grants limited access to specific resources (e.g., read photos, but not delete them).
  • It has an expiration time, enhancing security.

The Client presents this token to the Resource Server to get your data.

Simplified Flow at a Glance

Here's a high-level overview of how it works:

  1. You (Resource Owner) want to use an app (Client).
  2. The Client asks you for permission to access your data.
  3. You're redirected to the service provider (Authorization Server) to confirm.
  4. You grant permission.
  5. The Authorization Server gives the Client an Access Token.
  6. The Client uses this token to request data from the Resource Server.

Benefits of OAuth2

OAuth2 offers significant advantages:

  • Enhanced Security: No password sharing, limited access tokens.
  • User Control: You decide what data an app can access and for how long.
  • Interoperability: A standard protocol widely adopted across the web.
  • Reduced Risk: If a token is compromised, it has limited scope and lifespan.

It's the backbone of how many modern web services interact securely.

Check Your Understanding

Which of the following best describes the primary purpose of OAuth2?

Recap: OAuth2 Overview

In this lesson, we explored the fundamentals of OAuth2. We learned it's a protocol for delegated authorization, allowing apps to access your resources without needing your password.

We identified the four key roles: Resource Owner (you), Client Application (the app), Resource Server (where data lives), and Authorization Server (grants tokens).

Next, we'll dive into how OpenID Connect builds on OAuth2 for identity.

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

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

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

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

เรียนรู้แนวคิดหลักของ OAuth2 บทบาทต่าง ๆ (ไคลเอ็นต์ เจ้าของทรัพยากร เซิร์ฟเวอร์การอนุญาต) และจุดประสงค์ของโพรโทคอลนี้ คุณปฏิบัติ Spring Security 6 & JWT Authentication ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Spring Security 6 & JWT Authentication หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Spring Security 6 & JWT Authentication บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน

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

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

ฉันเขียนและรันโค้ดในบทเรียน Spring Security 6 & JWT Authentication นี้ได้ไหม

ได้ บทเรียน Spring Security 6 & JWT Authentication ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

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

  1. ภาพรวมโพรโทคอล OAuth2
  2. บทนำสู่ OpenID Connect
  3. ประเภทการให้สิทธิ์ OAuth2 ที่พบบ่อย
  4. PKCE และการรักษาความปลอดภัยให้ไคลเอ็นต์สาธารณะ
← กลับไปที่ Spring Security 6 & JWT Authentication