O365 logged in but still fails - Authentication request failed or expired for account mail@company.com - aborting login
See original GitHub issueI 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:
- Created 10 months ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
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
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.