https://github.com/tatsh/mutt-oauth2
Packaged, maintained version of contributed mutt_oauth2.py script.
https://github.com/tatsh/mutt-oauth2
email gmail mutt outlook
Last synced: 2 months ago
JSON representation
Packaged, maintained version of contributed mutt_oauth2.py script.
- Host: GitHub
- URL: https://github.com/tatsh/mutt-oauth2
- Owner: Tatsh
- License: mit
- Created: 2024-11-30T23:44:25.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2026-04-26T04:01:01.000Z (2 months ago)
- Last Synced: 2026-04-26T05:32:01.579Z (2 months ago)
- Topics: email, gmail, mutt, outlook
- Language: Python
- Homepage: https://tatsh.github.io/mutt-oauth2/
- Size: 6.58 MB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
- Citation: CITATION.cff
- Codeowners: CODEOWNERS
- Security: SECURITY.md
- Agents: AGENTS.md
Awesome Lists containing this project
README
# mutt-oauth2
[](https://www.python.org/)
[](https://pypi.org/project/mutt-oauth2/)
[](https://github.com/Tatsh/mutt-oauth2/tags)
[](https://github.com/Tatsh/mutt-oauth2/blob/master/LICENSE.txt)
[](https://github.com/Tatsh/mutt-oauth2/compare/v0.2.0...master)
[](https://github.com/Tatsh/mutt-oauth2/actions/workflows/codeql.yml)
[](https://github.com/Tatsh/mutt-oauth2/actions/workflows/qa.yml)
[](https://github.com/Tatsh/mutt-oauth2/actions/workflows/tests.yml)
[](https://coveralls.io/github/Tatsh/mutt-oauth2?branch=master)
[](https://github.com/dependabot)
[](https://mutt-oauth2.readthedocs.org/?badge=latest)
[](https://mypy-lang.org/)
[](https://docs.astral.sh/uv/)
[](https://docs.pytest.org/en/stable/)
[](https://github.com/astral-sh/ruff)
[](https://pepy.tech/project/mutt-oauth2)
[](https://github.com/Tatsh/mutt-oauth2/stargazers)
[](https://github.com/pre-commit/pre-commit)
[](https://prettier.io/)
[](https://bsky.app/profile/Tatsh.bsky.social)
[](https://buymeacoffee.com/Tatsh)
[](irc://irc.libera.chat/Tatsh)
[](https://hostux.social/@Tatsh)
[](https://www.patreon.com/Tatsh2)
This is an update of [Alexander Perlis' script](https://github.com/muttmua/mutt/blob/master/contrib/mutt_oauth2.py)
and conversion to a package. Instead of using GPG for token storage, this package uses Keyring.
## Installation
### Pip
```shell
pip install mutt-oauth2
```
## Usage
```plain
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`:
```plain
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}
```