MacOS – Can’t Authenticate the work gMail — I get right through the OTP dance then it simply fails

authenticationgooglemacosonelogin-otp

I've updated my iMac to Sierra (which is a red-herring, see further update below) and since then reset my work password, so need to re-authenticate via System Prefs > Internet Accounts. We use the OneLogin OTP system for 2fa.

So I go to Internet Accounts, enter my email and password, and it accepts that then displays the OneLogin 2fa screen.

enter OTP step

I hit the OTP send on my phone as per usual (I also have tried manually entering the code) and it accepts that and takes me to the 'remember' or 'forget' screen.

enter image description here

I click 'remember' and then it thinks, and then says 'Failed to authenticate with Google. Please try again later'.

auth failed

This same process works fine on my MacBook pro running El Capitan.

Any suggestions?

update I have also tried deleting all the relevant tokens from my keychain, with no improvement

Further update As part of deleting all the tokens in my keychain that seemed to have anything to do with Google or my work, I've now managed to wipe my work account completely from both macs (yay iCloud). Alas Now I am having the same issue on El Capitan so it's clearly not a Sierra specific issue. I'll change the headline to suit.

Best Answer

mitch [1:20 PM]
This happens to me also. I have found a workaround.

WORKAROUND:

In gmail, go to My Account (from your user icon), then Sign-in and Security, Allow less secure apps must be turned on.

Then, if you don't know your actual gmail password to use: In OneLogin, on the App Home page, click the Pencil icon next to the New App button top right, then click the icon you use to access GMail. In the resulting pop-up window, click the Change Google Apps password link and enter a password.

Now, go to System Preferences -> Internet Accounts, Add Other Account..., then configure gmail with plain ole IMAP (imap.gmail.com, smtp.gmail.com). PRESTO! Gmail working in Mail.app.