Print this article Edit this article

Using Alpine with Office365

Based on https://alpine.x10host.com/alpine/alpine-info/misc/SettingXOAUTH2Outlook.html

OAUTH2 with O365/Exchange MFA has been tested successfully on Alpine 2.24 and 2.25.  It has not been tested on 2.23.  Initial testing indicates it does not work with 2.22 since needed menu items are missing. Alpine's own HOWTO link shows Alpine 2.22 as an example, but it appears to actually not work with that version.

This was documented against Alpine 2.25 on Ubuntu 18.04 and 20.04. (built from source)
(Note: Alpine 2.25 in this case was built with --with-passfile=.pine-passfile)

* $ touch ~/.pine-passfile   (Doing this will permit Alpine to save the token so that you do not need to re-auth every time!)
* $ alpine
* Setup
* Config
* SMTP Server: smtp.office365.com/user=YourID@purdue.edu/submit/auth=xoauth2
* Inbox Path: {outlook.office365.com/ssl/user=YourID@purdue.edu/auth=xoauth2}INBOX
Note that it may be necessary to update other folders (Trash, Sent, Drafts), folder
collections, and your remote-pinerc to include "/auth=xoauth2" in the appropriate place.

* E(xit Setup)
* Quit
* $ alpine
* The "Authorizing Alpine Access to Outlook Email Services" message should come up.

Alpine xoauth2 signin

* Visit "https://microsoft.com/devicelogin" in a browser.
* Paste in the code into the browser to authorize alpine access.
* (Wait a few seconds in the Alpine window)
* You should be prompted to save the access token on disk. Press yes.
  (Or you will have to repeat this process on every login!)

Preserve refresh and access tokens on disk

* Create a master password for your password file - This is the password you will use to authenticate alpine from now on.

Enter password of key

 

Unknowns at this point: does the device have to be reauthorized after 30 days?  Most device authorizations (for instance when a Fire TV authorizes itself to use Twitter or another service) last indefinitely, but the reauthorization period might affect this too.

Update September 24, 2021:

Custom Alpine 2.25 packages have been built for Ubuntu 18.04 and 20.04 here.  Use at your own risk!

Ubuntu 20.04 (Focal Fossa): /ECN/Support/KB/Docs/UsingAlpinewitho365/alpine_2.25-1_focal_amd64.deb

Ubuntu 18.04 (Bionic Beaver): /ECN/Support/KB/Docs/UsingAlpinewitho365/alpine_2.25-1_bionic_amd64.deb

Ubuntu 16.04 (Xenial Xerus): /ECN/Support/KB/Docs/UsingAlpinewitho365/alpine_2.25-1_xenial_amd64.deb

Last Modified: Sep 24, 2021 4:50 pm America/New_York
Created: Jul 20, 2021 7:26 am GMT-4 by admin
JumpURL: