Skip to main content

mutt-oauth2

Python versions PyPI - Version GitHub tag (with filter) License GitHub commits since latest release (by SemVer including pre-releases) CodeQL QA Tests Coverage Status Dependabot Documentation Status mypy uv pytest Ruff Downloads Stargazers pre-commit Prettier

@Tatsh Buy Me A Coffee Libera.Chat Mastodon Follow Patreon

This is an update of Alexander Perlis' script and conversion to a package. Instead of using GPG for token storage, this package uses Keyring.

Installation

Pip

pip install mutt-oauth2

Usage

Usage: mutt-oauth2 [OPTIONS]

  Obtain and print a valid OAuth2 access token.

Options:
  -a, --authorize      Manually authorise new tokens.
  -d, --debug          Enable debug logging.
  -t, --test           Test authentication.
  -u, --username TEXT  Keyring username.
  -h, --help           Show this message and exit.

Start by calling mutt-oauth2 -a. Be sure to have your client ID and and client secret available.

Scopes required

Provider Scopes
Gmail Gmail API
Microsoft offline_access IMAP.AccessAsUser.All POP.AccessAsUser.All SMTP.Send

To support other accounts, use the --username argument with a unique string such as the account email address.

Test the script with the --test argument.

mutt configuration

Add the following to muttrc:

set imap_authenticators="oauthbearer:xoauth2"
set imap_oauth_refresh_command="/path/to/mutt-oauth2"
set smtp_authenticators=${imap_authenticators}
set smtp_oauth_refresh_command=${imap_oauth_refresh_command}

Metadata

Release files for mutt-oauth2 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mutt-oauth2 0.2.1
File Size Uploaded
mutt_oauth2-0.2.1.tar.gz 17.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mutt-oauth2 0.2.1
File Interpreter ABI Platform
mutt_oauth2-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.0 kB

Release files / mutt_oauth2-0.2.1.tar.gz

Download URL mutt_oauth2-0.2.1.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2b6dbaeb5f99151be650e1eccb56a11fd7501f2071430935274f4eb9ba82d613
BLAKE2b-256 checksum
How to use checksums
b93fda2193c644561fe1490804a8c16769c450c251a5048804638ecf6c377819
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.

Transparency log

Release files / mutt_oauth2-0.2.1-py3-none-any.whl

Download URL mutt_oauth2-0.2.1-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ddb816e790bca3e79d92a9d83ca5454b08273e4f08660774f0ab81277b541dbe
BLAKE2b-256 checksum
How to use checksums
276aad2df622a62b964e935a98580f0741eb4670145c6973d12f1a3b970116dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page