OAuth2: โพรโทคอลการมอบสิทธิ์
เรียนรู้วิธีที่ OAuth2 ช่วยให้แอปพลิเคชันของบุคคลที่สามเข้าถึงทรัพยากรของผู้ใช้บนเซิร์ฟเวอร์ได้ โดยไม่เปิดเผยข้อมูลรับรองของผู้ใช้
OAuth2: โพรโทคอลการมอบสิทธิ์ เป็นบทเรียน OAuth2 & OpenID Connect Deep Dive ฟรีบน CoddyKit นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน OAuth2 & OpenID Connect Deep Dive และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส OAuth2 & OpenID Connect Deep Dive มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
Welcome to OAuth2!
Hello! Today, we're diving into OAuth2, a crucial protocol for securing modern web and mobile applications. It's all about granting controlled access.
Think about how many apps connect to your social media, cloud storage, or email. OAuth2 makes these connections secure without you handing over your main password.
The Password Problem
In the past, if a third-party app (like a photo editor) needed to access your photos on a service (like Google Photos), you'd often have to give that app your Google password.
This was a huge security risk! The app would then have full access to your account, not just your photos, and could store your password unsafely.
Delegation to the Rescue
OAuth2 solves this problem through delegation. Instead of sharing your password, you delegate specific, limited access to a third-party application.
- You authorize the app.
- The app gets a special key.
- The app uses this key to access only what you allowed.
No Direct Password Sharing
This is the core principle of OAuth2: your original credentials (like your username and password) are never shared with the third-party application.
You interact directly with the service you trust (e.g., Google, Facebook) to grant permission, and that service then issues a token to the app.
The Valet Key Analogy
Imagine you're giving your car to a valet. You don't give them your master house key, right? You give them a valet key.
- It starts the car.
- It opens the doors.
- But it won't open the glove compartment or the trunk.
OAuth2 works similarly: it gives an app a 'valet key' to your digital resources.
Introducing Access Tokens
The 'valet key' in OAuth2 is called an Access Token. It's a string of characters that represents the permission you've granted.
- It's temporary.
- It has specific permissions.
- It's issued by the service you trust.
The third-party app uses this token to access your data, not your password.
Scopes: Defining Access
When you delegate access, you don't just grant 'all' access. You specify scopes.
Scopes are like permissions. For example, an app might request read_photos or write_calendar. You, the user, get to approve or deny these specific requests.
The Basic Delegation Flow
Here's a simplified view of how OAuth2 delegation works:
- You (the User) tell an App you want to connect it to a Service.
- The App redirects you to the Service to log in and approve.
- You log in to the Service and grant permission (e.g., 'Allow this app to read your photos').
- The Service gives the App an Access Token.
- The App uses this Access Token to interact with the Service on your behalf.
Why OAuth2 is Better
OAuth2 offers significant advantages:
- Enhanced Security: Your password is safe, never shared with third parties.
- Granular Control: You decide exactly what permissions an app gets.
- Revocable Access: You can revoke an app's access anytime without changing your password.
- Improved User Experience: A standardized, familiar process for connecting apps.
Delegation Protocol Check
You've learned that OAuth2 is a delegation protocol. Which of the following best describes its primary purpose?
Recap: OAuth2 Delegation
Great job! In this lesson, you learned that OAuth2 is a powerful delegation protocol.
- It solves the problem of sharing credentials with third-party apps.
- It works by issuing temporary Access Tokens with specific scopes.
- It keeps your main password secure and gives you control over your data.
Next, we'll explore the different roles involved in the OAuth2 dance!
คำถามที่พบบ่อย
บทเรียน “OAuth2: โพรโทคอลการมอบสิทธิ์” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “OAuth2: โพรโทคอลการมอบสิทธิ์” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส OAuth2 & OpenID Connect Deep Dive ให้อัปเกรดเป็น CoddyKit PRO คอร์ส OAuth2 & OpenID Connect Deep Dive มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “OAuth2: โพรโทคอลการมอบสิทธิ์”
เรียนรู้วิธีที่ OAuth2 ช่วยให้แอปพลิเคชันของบุคคลที่สามเข้าถึงทรัพยากรของผู้ใช้บนเซิร์ฟเวอร์ได้ โดยไม่เปิดเผยข้อมูลรับรองของผู้ใช้ คุณปฏิบัติ OAuth2 & OpenID Connect Deep Dive ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน OAuth2 & OpenID Connect Deep Dive หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน OAuth2 & OpenID Connect Deep Dive บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 1 จากทั้งหมด 4 บทเรียน
บทเรียน “OAuth2: โพรโทคอลการมอบสิทธิ์” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน OAuth2 & OpenID Connect Deep Dive นี้ได้ไหม
ได้ บทเรียน OAuth2 & OpenID Connect Deep Dive ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- OAuth2: โพรโทคอลการมอบสิทธิ์
- บทบาทและคำศัพท์ของ OAuth2
- ภาพรวมประเภทการมอบสิทธิ์หลัก
- โทเค็นเข้าถึง โทเค็นรีเฟรช และขอบเขต