OAuth 2.0 Libraries and Samples
The following libraries and samples make it easy to get started using OAuth 2.0
authorization to access the Gmail IMAP and SMTP services.
Java Sample
JavaMail 1.5.2 or later natively supports OAuth for IMAP.
If you need to use an older version, or create your own implementation, see the
Java sample code.
To download the sample, refer to
Tools and sample code for authenticating to Gmail with OAuth2.
Python Sample
PHP Sample
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-19 UTC.
[null,null,["Last updated 2024-12-19 UTC."],[[["This page provides libraries and samples to facilitate using OAuth 2.0 authorization for accessing Gmail IMAP and SMTP services."],["Sample code and tools are available for Java, Python, and PHP to help developers integrate OAuth 2.0 into their applications."],["JavaMail 1.5.2 and later natively support OAuth for IMAP, while older versions can utilize the provided Java sample code."],["Python and PHP developers can find getting started guides and downloadable samples for seamless OAuth 2.0 integration with Gmail."]]],["OAuth 2.0 authorization for Gmail IMAP and SMTP services is facilitated through provided libraries and samples. Java users with JavaMail 1.5.2+ have native OAuth support; older versions or custom implementations can use linked sample code. Python and PHP users can access \"Getting Started\" guides and download sample code via provided links. The tools for all three can be found in the linked Gmail OAuth2 repository.\n"]]