Sage CRM OAuth 2.0 with Outlook/Azure refresh token error

We have Sage CRM 2023 R2.1 and under Email Server Management Options I have a connection set up to a Microsoft 365 mailbox using Oauth 2.0. When setting this up following the guide on the Sage website it works fine, but after 90 days it stops working and starts showing this error in the log:

2024-07-31 00:47:35.681> OAuth Error : {"error":"invalid_grant","error_description":"AADSTS700082: The refresh token has expired due to inactivity. The token was issued on 2024-05-01T08:12:33.1186613Z and was inactive for 90.00:00:00. Trace ID: 54545454-4a73-4bdf-b78b-e5848fd64800 Correlation ID: dsdsdsds-db0e-4dbe-8bb7-ff1f18aeff00 Timestamp: 2024-07-30 23:47:35Z","error_codes":[700082],"timestamp":"2024-07-30 23:47:35Z","trace_id":"74036ed6-4a73-33df-b78b-3333fd64800","correlation_id":"f60f4da2-2222-4dbe-2222-ff1f18333f00","error_uri":"https://login.microsoftonline.com/error?code=700082"}

When this happens I need to delete the connection and re-add it, as simply going through the M365 login page again isn't enough to make it work. I then also need to generate a new client secret if I don't have the active one saved anywhere. This is every 90 days, so is quite annoying.

The error message suggests to me that CRM is not using the refresh token to get a new access token regularly like it should be, which is causing the refresh token to expire and become invalid. Does anyone know a way to get this working correctly so that the authorisation lasts longer than 90 days?

Parents Reply Children
No Data