{"id":20592041,"url":"https://github.com/rien/mfauth","last_synced_at":"2025-04-14T22:54:11.024Z","repository":{"id":46647905,"uuid":"410587820","full_name":"rien/mfauth","owner":"rien","description":null,"archived":false,"fork":false,"pushed_at":"2022-06-30T12:39:16.000Z","size":77,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-14T22:53:58.380Z","etag":null,"topics":["cli","hacktoberfest","oauth2-client"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rien.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-26T15:23:13.000Z","updated_at":"2024-02-08T17:26:05.000Z","dependencies_parsed_at":"2022-09-16T11:33:25.214Z","dependency_job_id":null,"html_url":"https://github.com/rien/mfauth","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rien%2Fmfauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rien%2Fmfauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rien%2Fmfauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rien%2Fmfauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rien","download_url":"https://codeload.github.com/rien/mfauth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248975329,"owners_count":21192208,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","hacktoberfest","oauth2-client"],"created_at":"2024-11-16T07:42:33.601Z","updated_at":"2025-04-14T22:54:11.005Z","avatar_url":"https://github.com/rien.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MFAuth\n\n_Multi Factor Authentication CLI_\n\nSimple CLI tool to request and manage OAuth2 tokens. Can be used with `mbsync` and `msmtp` to receive and send mail with providers requiring OAuth2 authentication.\n\n## Installation\n\n1. Install Rust, either with your package manager or using [rustup](https://rustup.rs/)\n2. Install `mfauth` using `cargo`\n  ```\n  cargo install mfauth\n  ```\n3. Test if it works by running `mfauth help`\n\nIf you see a `command not found` error, you can try putting `$HOME/.cargo/bin`  in your `$PATH`.\n\n## Usage\n\n1. Run `mfauth init` to create an example configuration file in `$HOME/.config/mfauth/config.toml`\n2. Edit the configuration file (`$EDITOR $HOME/.config/mfauth/config.toml`)\n3. Run `mfauth authorize \u003caccount\u003e` to get a valid session (an access and refresh token), this will save this session in `$HOME/.cache/mfauth/cache.toml`\n4. Run `mfauth access \u003caccount\u003e` to get a valid access token, this will automatically refresh tokens if needed\n5. Configure your mail client to use `XOAUTH2` authentication and use mfauth to fetch the access tokens\n\nOnce in a while this might stop working if your session expires. If that happens, you can simply run `mfauth authorize \u003caccount\u003e` again and you're good to go!\n\n\n### Example with msmtp (sending)\n\nA working account entry in the msmtp config using mfauth:\n\n```\naccount microsoft\nauth xoauth2\nfrom username@outlook.com\nhost outlook.office365.com\npasswordeval /home/user/.cargo/bin/mfauth access microsoft\nport 587\ntls on\ntls_starttls on\ntls_trust_file /etc/ssl/certs/ca-certificates.crt\nuser username@outlook.com\n```\n\n### Example with mbsync (receiving)\n\n**Important:** isync requires the [`cyrus-sasl-xoauth2`](https://github.com/moriyoshi/cyrus-sasl-xoauth2) extension installed to support the `XOAUTH2` authentication protocol.\n\nThis is an example of a working `IMAPAccount` block using mfauth.\n\n```\nIMAPAccount microsoft\nAuthMechs XOAUTH2\nCertificateFile /etc/ssl/certs/ca-certificates.crt\nHost outlook.office365.com\nPassCmd \"/home/user/.cargo/bin/mfauth access microsoft\"\nPort 993\nSSLType IMAPS\nUser username@outlook.com\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frien%2Fmfauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frien%2Fmfauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frien%2Fmfauth/lists"}