Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to fetch IMAP folders from Exchange Online using OAuth #2264

Closed
salimnassim opened this issue Sep 21, 2022 · 22 comments
Closed

Unable to fetch IMAP folders from Exchange Online using OAuth #2264

salimnassim opened this issue Sep 21, 2022 · 22 comments
Labels
help wanted Extra attention is needed

Comments

@salimnassim
Copy link

salimnassim commented Sep 21, 2022

We're having issues with fetching IMAP folders from a Exchange Online mailbox.

The mailbox is a regular user and not a shared mailbox, and it has a valid Exchange license.

OAuth has been configured correctly according to https://github.com/freescout-helpdesk/freescout/wiki/Connect-FreeScout-to-Microsoft-365-Exchange-via-OAuth and the auth flow works.

When I try to retrieve IMAP folders I get the following message "Connected, but no IMAP folders found" and IMAP folders field will be populated with the default "INBOX". Clicking "check connection" after saving displays the following error "Could not get mailbox folder: INBOX". Due to this problem emails wont be retrieved from the mailbox.

App version is 1.8.26 and the system status page does not display any errors.

Any ideas? Thanks

@freescout-helpdesk
Copy link
Contributor

It looks like something is going on in MS365 system. Some people are receiving "connection setup failed" error. You can't get IMAP folders...

@freescout-helpdesk
Copy link
Contributor

#2248 #2232

@freescout-helpdesk
Copy link
Contributor

What happens when you click "Check Connection" button in your mailbox?

@freescout-helpdesk
Copy link
Contributor

freescout-helpdesk commented Sep 22, 2022

@salimnassim Does the MS365 user you are using to connect have a mailbox in MS365 and a license allowing to access it (try to open https://outlook.office365.com/mail/)?

@salimnassim
Copy link
Author

What happens when you click "Check Connection" button in your mailbox?

I get a red popup notification which says "Could not get mailbox folder: INBOX"

@salimnassim Does the MS365 user you are using to connect have a mailbox in MS365 and a license allowing to access it (try to open https://outlook.office365.com/mail/)?

The user account has a working mailbox and I can access it directly through the PWA and Outlook.

@freescout-helpdesk
Copy link
Contributor

Try to contact MS365 support and ask why INBOX folder is not available via OAuth IMAP. Maybe they added some restrictions...

@salimnassim
Copy link
Author

Try to contact MS365 support and ask why INBOX folder is not available via OAuth IMAP. Maybe they added some restrictions...

I have created a ticket for Microsoft regarding this issue. I will update this ticket in case they have a solution.

@salimnassim
Copy link
Author

Apparently there's an ongoing issue with accessing mailbox via IMAP and the problem affects OAuth/Graph as well. This is the reply from them in case anybody else is having the same issue.

I've confirmed that you're affected by a service incident causing IMAP issue. We understood that resolving this issue is very important for your business. Rest assured that our Microsoft engineers are continuously working to resolve this issue.

Here's the incident you're affected with:

Sep 15, 2022, 11:06:42 PM
Exchange Online
EX431096
Users may have been unable to connect to their mailboxes via the Outlook desktop app with IMAP.

@freescout-helpdesk
Copy link
Contributor

Thanks for sharing the info.

@salimnassim
Copy link
Author

After Microsoft reported that the issue I referenced to is fixed the problem with retrieving folders still persists. I have tested accessing the same mailbox via IMAP using other software such as Thunderbird and it works flawlessly. Is this an issue with Webklex/php-imap perhaps? Any ideas how to debug this further? Thanks

@freescout-helpdesk
Copy link
Contributor

It seems you are the only one receiving "Connected, but no IMAP folders found" error so far. You need a developer who can debug Webklex/php-imap.

@jeliasson
Copy link

It seems you are the only one receiving "Connected, but no IMAP folders found" error so far. You need a developer who can debug Webklex/php-imap.

We also seem to have this issue where we get "Connected, but no IMAP folders found". We will continue to troubleshoot on our side, but would love some help on what that could be.

@freescout-helpdesk
Copy link
Contributor

@freescout-helpdesk freescout-helpdesk added the help wanted Extra attention is needed label Oct 11, 2022
@pathab
Copy link

pathab commented Oct 13, 2022

We also had connection issues to IMAP folder of all mailboxes today. All mailboxes are Microsoft 365 Exchange mailboxes. We were able to resolve the connection issues by switching the connections to OAuth. Thanks for the instructions! (https://github.com/freescout-helpdesk/freescout/wiki/Connect-FreeScout-to-Microsoft-365-Exchange-via-OAuth)

Unfortunately, after that, we were unable to retrieve IMAP folders for all mailboxes.

The problem is that we use the SAML SSO module. So the personal account is always logged in. When we clicked "Connect", the authentication was done with the personal account and not with the account of the mailbox.
grafik

The solution to solve this problem was:

  1. disconnect again
  2. open Freescout in a private window in the browser
  3. login as admin with the URL: yourfreescouturl.com/login?saml=0
  4. connect again to the "Microsoft Exchange" under connection settings
  5. authenticate with the user of the mailbox
  6. done :-)

I hope this helps you.

Edit:
The problem will probably also exist independently of the "SAML SSO" module. Of course, this may also be due to the SSO of office.com, which triggers authentication with the personal account and not with the respective mailbox user.

@salimnassim
Copy link
Author

Logging in with the mailbox user solved this issue for us, and we are able to retrieve the IMAP folders. My assumption was that the system would be smart enough to use the correct mailbox via OAuth but this was not the case.

Thanks for the workaround @pathab !

@freescout-helpdesk
Copy link
Contributor

Good to know.

@PebiValeur
Copy link

I'm still experiencing this issue regarding connection setup failed.
Although there is a quick fix, where you click check connection twice.
1st time it comes with an error message "Connection setup failed"
2nd time it comes with "Connection established", and then again we are able to recieve mails for about 2 hours before it cuts the connection once more.

We are currently running an older version, due to the fact we are running it on a live enviroment.
Aswell as the fear of losing some of the settings.

Right now the version we have running is 1.8.12.
could that have anything to do with it?
Please let me know if there's anything else you need from me

thanks in advance!

@justinipg
Copy link

i'm getting an error from Microsoft saying the following.

AADSTS50011: The redirect URI 'https://servicedesk.XXX.net.au/mailbox/oauth' specified in the request does not match the redirect URIs configured for the application '288c5f41-5671-4726-9ece-XXXXXX'. Make sure the redirect URI sent in the request matches one added to your application in the Azure portal. Navigate to https://aka.ms/redirectUriMismatchError to learn more about how to fix this.

when i go to the /mailbox/oath address all i receive is a "Sorry, the page you are looking for could not be found"

@mateit-cloudware
Copy link

mateit-cloudware commented Nov 6, 2023

HI There, we have setup the Azure AD Connection to fetch mail. But are facing the following issue:
image

We cleared the cache and also connected again. Folders where fetched perfectly all premissions are set in Azure. So still the same issue. Can you please help?

We have installed Freescout via Cloudron

@freescout-helpdesk
Copy link
Contributor

@mateit-cloudware Create a new separate issue. Also specify where and at what moment are you getting this error.

@mateit-cloudware
Copy link

@freescout-helpdesk: thank you. Done
#3503

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants