simonrob / email-oauth2-proxy

An IMAP/POP/SMTP proxy that transparently adds OAuth 2.0 authentication for email clients that don't support this method.
Apache License 2.0
785 stars 84 forks source link

Microsoft 365 issue #221

Closed EnricoSx closed 7 months ago

EnricoSx commented 7 months ago

Request Id: 7d01d65f-bee2-4e7b-abb7-3d7b8245ec02 Correlation Id: 98cf4703-9ef8-480a-8e70-4cca2be4cfda Timestamp: 2024-01-10T16:49:32Z Message: AADSTS700016: Application with identifier 'g.schiavo' was not found in the directory 'xxxx'. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant.

[SMTP-1587] server_address = smtp.office365.com server_port = 587 starttls = True local_address = 127.0.0.1

[xxxx] 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 = xxxx@xxx.xx client_secret = xxx

[emailproxy] delete_account_token_on_password_error = True encrypt_client_secret_on_first_use = False allow_catch_all_accounts = False

2024-01-10 17:46:35,884: Authorisation request received for xx@xxxx.xxx(interactive mode) 2024-01-10 17:46:48,414: Waiting for URL matching redirect_uri; following browser redirection to login.microsoftonline.com/[...] 2024-01-10 17:46:54,515: Waiting for URL matching redirect_uri; following browser redirection to login.microsoftonline.com/[...] 2024-01-10 17:48:01,846: Waiting for URL matching redirect_uri; following browser redirection to login.microsoftonline.com/[...] 2024-01-10 17:48:06,133: Waiting for URL matching redirect_uri; following browser redirection to login.microsoftonline.com/[...] 2024-01-10 17:48:17,850: Waiting for URL matching redirect_uri; following browser redirection to login.microsoftonline.com/[...] 2024-01-10 17:48:19,564: Waiting for URL matching redirect_uri; following browser redirection to login.microsoftonline.com/[...] 2024-01-10 17:48:29,234: Waiting for URL matching redirect_uri; following browser redirection to login.microsoftonline.com/[...] 2024-01-10 17:49:01,770: Waiting for URL matching redirect_uri; following browser redirection to login.microsoftonline.com/[...] 2024-01-10 17:49:07,066: Waiting for URL matching redirect_uri; following browser redirection to login.microsoftonline.com/[...] 2024-01-10 17:49:32,545: Waiting for URL matching redirect_uri; following browser redirection to login.microsoftonline.com/[...]

simonrob commented 7 months ago

Please look at the first part of the message you have posted – this is an AAD/Entra issue (a missing user g.schiavo?), and not something the proxy can control.

(I also suspect you are using an invalid client ID – this does not normally contain an @ – it is not your email address)