Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAuth2 support #28

Open
wouter-swierstra opened this issue Jun 29, 2020 · 8 comments
Open

OAuth2 support #28

wouter-swierstra opened this issue Jun 29, 2020 · 8 comments

Comments

@wouter-swierstra
Copy link

I was wondering if anyone has had any luck configuring mutt and office365 to use two factor authentication (and OAuth2 in particular). I've seen a few Python scripts that can be used to get/store OAuth2 tokens to access gmail using mutt -- but nothing similar for office 365.

PS - Thanks for putting this online! It's very useful indeed.

@moertel
Copy link

moertel commented Sep 27, 2020

@wouter-swierstra just in case you're not aware of this already, there is a way to use mutt with Microsoft/Office365 accounts. You download a script and follow the instructions in the README:

I did not have success connecting it to a company account but have heard of people where this method works for their personal account. (If anyone successfully connects to a company/AzureAD Office365 account with it, please ping me.)

@wouter-swierstra
Copy link
Author

@moertel Yes -- I saw that the mutt developers have been adding support for this - which is great news! I haven't upgraded my mutt client to the latest version, so I haven't looked into this yet. I have managed to set up the Azure developer permissions, which have let me login, send and receive email using a Python script. Once a newer mutt version lands in Ubuntu, I'm hopeful things should work.

@vamsikrishnav
Copy link

@wouter-swierstra just in case you're not aware of this already, there is a way to use mutt with Microsoft/Office365 accounts. You download a script and follow the instructions in the README:

I did not have success connecting it to a company account but have heard of people where this method works for their personal account. (If anyone successfully connects to a company/AzureAD Office365 account with it, please ping me.)

I have had the same problem. I think one needs to register an app to get a client id. But my organizations o365 admin has disabled this registering. Also I have always been getting an error while using the IMAP with mutt 'BAD User is authenticated but not connected.' I have tried everything but nothing works. Would love to use mutt again

@ghost
Copy link

ghost commented Aug 27, 2021

@moertel
I can successfully connect to a company Office365 account with mutt.
When following mutt_oauth2.py.README, make sure to comment (delete) the values (e.g. imap_user, folder...) in user and muttrc.
The values provided by the config from this repo are not applicable for OAuth2 so you need to make sure you have overrided the values with the correct ones according to the README.

For @vamsikrishnav 's issue, you can follow the instructions in mutt_oauth2.py.README and try contacting your organization's admin first.
If that fails you can try logging in to your Office365 account with another well-known IMAP/POP/SMTP client (such as the one starting with letter "T", which is a free and open-source cross-platform email client).
If that client works, then:

you could dig into the source code for that client and
extract its client_id, client_secret, and redirect_uri and put those
into the mutt_oauth2.py script. This would be a temporary punt for
end-user experimentation, but not an approach for configuring systems
to be used by other people. Engaging your institution admins to create
a mutt registration is the better way to go.

@andhe
Copy link

andhe commented Oct 15, 2021

FWIW https://www.vanormondt.net/~peter/blog/2021-03-16-mutt-office365-mfa.html

@meredithkr
Copy link

@jloqfjgk
Could you please elaborate on finding the client_id and secred and redirect_uri? Where would I look for this? I was able to get Thunderbird do this with no problems, but I would prefer using mutt. Thank you!

@meredithkr
Copy link

@andhe

I tried following those instructions, but the first problem I am having is that TOKEN_FILE they mention. I am assuming I need to obtain that before running the oauth2 script, correct? How do I go about that? Thank you!

@raffaem
Copy link

raffaem commented Oct 6, 2022

@andhe

I tried following those instructions, but the first problem I am having is that TOKEN_FILE they mention. I am assuming I need to obtain that before running the oauth2 script, correct? How do I go about that? Thank you!

The TOKEN_FILE is a file that stores the token created bu the oauth2 script.

It's an output file, not an input one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants