reddit / emacs
Trouble with mu4e/offlineimap/office365 setup
lykwydchykyn · 2022-10-14 16:21
I've been using mu4e with offlineimap for years to access my employer's office365 email. Suddenly yesterday it just stopped working.
We have 2FA enabled so I've been using an app password to access. Suddenly offlineimap gives me this error:
PLAIN authentication failed: b'AUTHENTICATE failed.'
LOGIN authentication failed: b'LOGIN failed.'
I tried creating a new app password for my account and updating my authinfo file, but it didn't make any difference. Anyone have any advice?
johnMediaOnFire · 2022-10-14 17:06
Outlook 365 disabled non-OAUTH logins in October.
For offlineimap I followed: https://github.com/UvA-FNWI/M365-IMAP
For SMTP (I use gnus) I followed: https://wiki.archlinux.org/title/Msmtp
jsled · 2022-10-14 17:12
Another option, u/lykwydchykyn is https://gitlab.com/muttmua/mutt/-/blob/master/contrib/mutt_oauth2.py , which has support for GPG-based storage of the secrets, and can do the token re-negotiation on demand, as well.
I needed to build a relatively recent version of mbsync (later than what was packaged for my OL8.6 machine), and also compile https://github.com/moriyoshi/cyrus-sasl-xoauth2 to get all the pieces to work together. Oh, yes, and a more recent version of msmtp, similarly to get xoauth2 support.
lykwydchykyn · 2022-10-14 17:20
Thank you, I'll look into this.
lykwydchykyn · 2022-10-14 17:45
Got it working! WOoohooo! Thanks a ton!
Schievel1 · 2022-10-15 07:54
Since the expertise is already gathered here... I have a question regarding mu4e and outlook.
At home I am a happy mu4e user. At work I am using emacs in WSL and MS Office Outlook (the program, not a website). I have a Microsoft account at work if that's relevant.
Is there any chance I could use mu4e at work as well? Sadly documentation on this is rather sparse.
titanofold · 2022-10-15 15:34
Yes, you can. Running in WSL is the same as Linux as far as Emacs is concerned. There's no additional considerations except for notifications, maybe.
Schievel1 · 2022-10-15 16:23
Great, so how do you do it?
AFAIK I can not use normal IMAP with outlook servers can I?
thegreat0 · 2022-10-21 10:41
Could you elaborate a little more what you did? I'm currently facing the same issue. Thanks!
lykwydchykyn · 2022-10-21 13:29
I followed the github instructions linked above.
thegreat0 · 2022-10-22 12:12
Did you create your own app in azure or use the Thunderbird one?
lykwydchykyn · 2022-10-23 18:30
Thunderbird
thegreat0 · 2022-10-24 22:17
Thanks. Worked like a charm.
stumped_dimension · 2022-10-27 12:15
I tried to follow the instructions (complete ignorant here), but in step 2, I do not know what I am supposed to enter in `ClientSecret` in file cofig.py.
If I go to https://hg.mozilla.org/comm-central/file/tip/mailnews/base/src/OAuth2Providers.jsm
I can see clientId: "9e5f94bc-e8a4-4e73-b8be-63364c29d753" (line 132) but no ClientSecret.
I tried with arbitrary values for ClientSecret, but I keep getting an error:
The redirect URI 'http://localhost:8745/' specified in the request does not match the redirect URIs configured for the application '9e5f94bc-e8a4-4e73-b8be-63364c29d753'.
lykwydchykyn · 2022-10-27 14:24
I used the values from lines 84 & 85.
stumped_dimension · 2022-10-27 17:28
Thanks!
Actually, I found my mistake (which can be traced to my not reading carefully ;-( ).
In case anyone else has a similar problem, here are instructions for those that suffer bouts of careless reading, like myself:
- Step 2: use the provided script. Nothing needs to be changed.
- Step 3: use these values for the last three entries; the first two come directly from config.py
- oauth2_client_id = 08162f7c-0fd2-4200-a84a-f25a4db0b584
- oauth2_client_secret = TxRBilcHdC6WGBee]fs?QR:SJ8nI[g82
- oauth2_refresh_token = <contents of file imap_smtp_refresh_token generated in Step 2>
(So I did not use the values of either lines 84 and 85, nor 132, but the ones in the config.py script).