question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

O365 logged in but still fails - Authentication request failed or expired for account mail@company.com - aborting login

See original GitHub issue

I am having a bit of trouble getting this to work on Server 2012 for Spiceworks helpdesk system. So far I have gotten to the point where I can type in the password in the O365 login prompt on the server but then this happens:

2022-11-08 09:07:49,536: Authorisation request received for mail@company.com (interactive mode) 2022-11-08 09:07:57,593: Waiting for URL matching redirect_uri; following browser redirection to login.microsoftonline.com/[...] 2022-11-08 09:07:58,044: Waiting for URL matching redirect_uri; following browser redirection to login.live.com/[...] 2022-11-08 09:08:03,045: Successfully authorised request for mail@company.com 2022-11-08 09:08:03,045: Authentication request failed or expired for account mail@company.com - aborting login 2022-11-08 09:08:03,045: IMAP (localhost:1993; 127.0.0.1:4909->outlook.office365.com:993) <-- b'RUBY0001 NO LOGIN Email OAuth 2.0 Proxy: Login failed - the authentication request expired or was cancelled for account mail@company.com\r\n' 2022-11-08 09:08:03,045: IMAP (localhost:1993; 127.0.0.1:4909->outlook.office365.com:993) <-- b'* BYE Autologout; authentication failed\r\n'

[mail@company.com] permission_url = https://login.microsoftonline.com/common/oauth2/v2.0/authorize token_url = https://login.microsoftonline.com/common/oauth2/v2.0/token oauth2_scope = https://outlook.office365.com/IMAP.AccessAsUser.All https://outlook.office365.com/POP.AccessAsUser.All https://outlook.office365.com/SMTP.Send offline_access redirect_uri = http://localhost client_id = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX client_secret = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Not sure what to do now.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
danininocommented, Nov 10, 2022

Don’t know how I missed the Tenant ID thing, I got it authorized now. Using the http://localhost/oauth for both the Azure and the proxyconfig. Perhaps it is because the helpdesk was already running on the localhost address? I am running on Windows Server 2016. Any tips on getting this to run as a service? So we don’t need to login with a user to have it running?

Also, thank you for excellent support

0reactions
simonrobcommented, Nov 10, 2022

Glad this was resolved - thanks for following up.

I don’t use Windows so can’t really help with running the script as a service I’m afraid.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Authentication automatically fails in Microsoft 365 services
Symptoms. Authentication automatically fails in some Microsoft Office applications and Outlook may go into the "Need Password" state without any ...
Read more >
FAQ, Downloads and Support Packages | GOGET
Or: “The request failed. The remote server returned an error: (401) Unauthorized.” The service account password is wrong. The username syntax is wrong....
Read more >
Configure an incoming e-mail account for Office 365
Log in to your Exchange account and verify that Multi-factor Authentication for Office 365 is enabled. See Set up multi-factor authentication located on...
Read more >
How do I resolve Duo user login issues in Office 365 caused ...
When the IdP is the DAG, this process will fail causing the user to be unable to re-connect to O365 with applications such...
Read more >
Office 365 Login Issues - Dialpad Help Center
If you receive an error when trying to log into Dialpad with your Office 365 account, your Office 365 Admin may not have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found