Mail receive with OAuth 2.0

Post Reply
Moosi
Newbie
Posts: 5
Joined: Mon Jan 09, 2017 10:47 pm

Mail receive with OAuth 2.0

Post by Moosi »

Hello!

We are running the latest version of Mail receive with OAuth 2.0 to receive and inject mails from Outlook/Office365. The apop works fine for some time, but after some days (7-10, not really sure if it happens regulary after 1 week) the app seems to lose the connection/authorization and stops working (see first picture).
OAuth_Error2.png
OAuth_Error2.png (3.29 KiB) Viewed 4117 times
And we receive this error message:
OAuth_Error.JPG
OAuth_Error.JPG (16.59 KiB) Viewed 4117 times
To resolve the issue, we have to reauthorize the app by running the OAuth process again.
The problem is, that we do not always recognize the error message for some time and then no emails are injected to Switch.

Is this how it should work, can we increase the timeout or can we even get this to work without having to reauthorize at all?

Thanks for any suggestions!
wkopp
Member
Posts: 27
Joined: Mon Sep 16, 2019 8:20 pm

Re: Mail receive with OAuth 2.0

Post by wkopp »

We had a similar issue when we installed this app. (Using v2.0 with Switch 2021 Fall) Reached out to the dev and they suggested we check our Switch preferences. You can set Switch to retry after an error.

Under [Error handling > Retry failed external processes after (minutes)], make sure you've got a value set there. We set ours to 5 min and haven't had a problem since.

Hope this helps!
Attachments
Preferences.png
Preferences.png (19.26 KiB) Viewed 4079 times
freddyp
Advanced member
Posts: 1183
Joined: Thu Feb 09, 2012 3:53 pm

Re: Mail receive with OAuth 2.0

Post by freddyp »

When you get the error that there was a timeout then what wkopp wrote applies. It is unfortunately regularly the case that the Outlook cloud service does not always respond quickly. But Switch will retry and you will probably not notice. Reauthenticating is not necessary.

Next to that you can also regularly get the message that the refresh token is no longer valid. In that case you will have to reauthenticate. This is (very) annoying but this is how OAuth2.0 works. The refresh interval depends on the service you are using. Some services allow you to define that period so it is worthwhile checking to see if you can increase it. Some services only allow you to do that when you use the premium version. However, it is unlikely that the validity period will be eternal. That is the price to pay for increased security.
PdFUser5000
Member
Posts: 145
Joined: Fri Jun 12, 2020 11:23 am

Re: Mail receive with OAuth 2.0

Post by PdFUser5000 »

freddyp wrote: Mon Mar 13, 2023 2:56 pm When you get the error that there was a timeout then what wkopp wrote applies. It is unfortunately regularly the case that the Outlook cloud service does not always respond quickly. But Switch will retry and you will probably not notice. Reauthenticating is not necessary.

Next to that you can also regularly get the message that the refresh token is no longer valid. In that case you will have to reauthenticate. This is (very) annoying but this is how OAuth2.0 works. The refresh interval depends on the service you are using. Some services allow you to define that period so it is worthwhile checking to see if you can increase it. Some services only allow you to do that when you use the premium version. However, it is unlikely that the validity period will be eternal. That is the price to pay for increased security.
Does this still apply in 2026? We've been getting similar errors with Oauth. For example:

Message: Mail receive component failed during operation perform: Failed to connect to mail server after retries.
Message: Mail receive component failed during operation perform: Timed out while authenticating with server
Message: Mail receive component failed during operation perform: Cannot get valid access token: Response Error: 400 Bad Request
Message: Mail receive component failed during operation perform: Server Unavailable. 15
Post Reply