ไลบรารีและตัวอย่าง OAuth 2.0
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ไลบรารีและตัวอย่างต่อไปนี้ช่วยให้เริ่มต้นใช้งานการให้สิทธิ์ OAuth 2.0 เพื่อเข้าถึงบริการ IMAP และ SMTP ของ Gmail ได้ง่าย
ตัวอย่าง Java
JavaMail 1.5.2 ขึ้นไปรองรับ OAuth สำหรับ IMAP โดยค่าเริ่มต้น
หากต้องการใช้เวอร์ชันเก่ากว่านี้หรือสร้างการติดตั้งใช้งานของคุณเอง โปรดดูโค้ดตัวอย่าง Java
หากต้องการดาวน์โหลดตัวอย่าง โปรดดูเครื่องมือและโค้ดตัวอย่างสำหรับการตรวจสอบสิทธิ์ใน Gmail ด้วย OAuth2
ตัวอย่าง Python
ตัวอย่าง PHP
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-29 UTC
[null,null,["อัปเดตล่าสุด 2025-08-29 UTC"],[],[],null,["# OAuth 2.0 Libraries and Samples\n\nThe following libraries and samples make it easy to get started using OAuth 2.0\nauthorization to access the Gmail IMAP and SMTP services.\n\nJava Sample\n-----------\n\nJavaMail 1.5.2 or later [natively supports OAuth for IMAP](https://javaee.github.io/javamail/OAuth2).\nIf you need to use an older version, or create your own implementation, see the\n[Java sample code](https://github.com/google/gmail-oauth2-tools/wiki/JavaSampleCode).\nTo download the sample, refer to\n[Tools and sample code for authenticating to Gmail with OAuth2](https://github.com/google/gmail-oauth2-tools).\n\nPython Sample\n-------------\n\n- [Getting Started](https://github.com/google/gmail-oauth2-tools/wiki/OAuth2DotPyRunThrough)\n- [Download](https://raw.githubusercontent.com/google/gmail-oauth2-tools/master/python/oauth2.py)\n\nPHP Sample\n----------\n\n- [Getting Started](https://github.com/google/gmail-oauth2-tools/wiki/PhpSampleCode)\n- [Download](https://github.com/google/gmail-oauth2-tools/blob/master/php/oauth2.php)"]]