Alpine with MS365 using OAuth2

Important:

The guidelines below only apply if your email account is in MS365. All accounts at UiO will be migrated there in the fall of 2024. If you are unsure whether your email is in MS365, you can check it as follows:

Go to →outlook.office.com. If you see a login window and can log in, you have been migrated. If you are asked to click on a link to be redirected, you have not been migrated.

Installation of Alpine 2.26

Depending on your Linux Distribution, available alpine packages may be too old to connect to Microsoft 365.  These instructions show how to install Alpine 2.26 in your Linux home directory:

mkdir -p ~/alpine-2.26/build
cd ~/alpine-2.26/build
wget https://alpineapp.email/alpine/release/src/alpine-2.26.tar.xz
tar Jxvf alpine-2.26.tar.xz
rm -f ~/alpine-2.26/build/alpine-2.26.tar.xz
cd ~/alpine-2.26/build/alpine-2.26
./configure --prefix=$HOME/alpine-2.26/
make
make install
rm -rf ~/alpine-2.26/build
cd ~/
export PATH=~/alpine-2.26/bin:$PATH

NOTE: You may need install some dependencies to build this software such as ncurses-devel or libncurses-dev.

Configuring Alpine

First - we'll run the program and quit it to generate a default ~/.pinerc file:

  1. Run the command 'alpine'
  2. Press 'E' to exit the default greeting
  3. Press 'Q' to quit (and 'Y' to confirm)

Now use your favorite text editor to modify your ~/.pinerc file and update the following fields:

personal-name=YOURLASTNAME, YOURFIRSTNAME
user-domain=uio.no
 
customized-hdrs=From: "YOURLASTNAME, YOURFIRSTNAME" 
smtp-server=smtp.office365.com/user=USERNAME@uio.no/submit/auth=xoauth2
inbox-path={outlook.office365.com/ssl/user=USERNAME@uio.no/auth=xoauth2}INBOX
postponed-folder={outlook.office365.com/ssl/user=USERNAME@uio.no/auth=xoauth2}Drafts
trash-folder={outlook.office365.com/ssl/user=USERNAME@uio.no/auth=xoauth2}Deleted Items
folder-collections=mail/[],Office365 {outlook.office365.com/ssl/user=USERNAME@uio.no/auth=xoauth2}[]

Open Alpine again and you should be greeted with the message Authorizing Alpine Access to Outlook Email Services:

Go to the URL from the message (https://microsoft.com/devicelogin) and enter the provided code - complete the web-based Office 365 based authentication steps.  Once you have completed the authentication steps in your browser, Alpine will prompt (at the bottom) Preserve Refresh and Access tokens on DISK for next login?, select 'Y'.

Alpine will then create a Master Password File (at ~/.pine-passfile) - this is how Alpine protects your authentication to Office365 without having to go through the web-based authentication each time. Create a master password for Alpine as prompted (and a second time to confirm).

Now you should be able to go to your "INBOX" and see your e-mail.

If you go to the Folder List you should see an "Office 365" option to see your account sub-folders (this is from the "folder-collections" setting in ~/.pinerc)

When you start alpine going forward, it will automatically prompt for the Alpine "master password" (the message is Enter password of key <MasterPassword> to unlock password file:) - this is NOT your NETID password, but the password you created above - it is specific to Alpine only.

Official Documentation:

Did you find what you were looking for?
Contact support

Call us

Opening hours are weekdays from 08:30 to 17:00 and Saturdays from 10:00 to 15:00.

Phone number: 22 84 00 04

Register case

Your request can be sent to it-support@uio.no.

Send email

Book a Zoom meeting

Students and employees can book a Zoom meeting with UiO Helpdesk. Available hours are Tuesday to Thursday between 11:00 and 13:00.

Book a video call

Chat with us

Our chat is open every weekday between 09:00 and 16:00.

Start chat
Published Sep. 5, 2024 11:04 PM - Last modified Sep. 11, 2024 2:21 PM