Office 365 authentication fails to complete

Description

I am trying to add an office 365 account. When I select office 365 in the account type selection dialogue, I get shown the e"connecting with office 365" dialogue with the URL below the “Did it not open?” message. Sure enough, my browser (Firefox) opens and after a bit of struggle (I have accounts on office 365 with multiple organisations, the first of which requires “administrator permission” to connect mailspring, however, I want to connect with one that does not. This might be a clue as I get to “you need admin perm” sometimes when this opens and I need to click “I have admin” to select the other org account) and I do get to the “Mailspring” page. The window focus shifts back to the mailspring “connecting…” dialogue but there is no user feedback that something is happening and it looks like the program is stuck for a very long time (5-10 minutes). Finally, I get the response “we are unable to connect with your smtp settings”

Steps to reproduce the behavior:

  1. Click on add account.
  2. Select office 365
  3. Login to organisation successfully until getting to (Mailspring)

Expected:
4. Account is created
or
4. Failure happens much faster with useful feedback

mspr 1.9.1 (505) via snap
ubuntu 20.04