OAuth 2.0 のライブラリとサンプル
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
次のライブラリとサンプルを使用すると、OAuth 2.0 認証を使用して Gmail IMAP サービスと SMTP サービスに簡単にアクセスできます。
Java サンプル
JavaMail 1.5.2 以降では、IMAP の OAuth がネイティブにサポートされています。古いバージョンを使用する必要がある場合や、独自の実装を作成する場合は、Java サンプルコードをご覧ください。サンプルをダウンロードするには、OAuth2 を使用して Gmail を認証するためのツールとサンプルコードを参照してください。
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)"]]