{"title":"Troubleshooting: SAML2 token errors with Microsoft Entra ID / Office 365 Authentication","url":"https://jonas-paprotka.de/docs/dev-itpro/administration/troubleshooting-saml2-token-not-valid-because-validity-period-ended/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/troubleshooting-saml2-token-not-valid-because-validity-period-ended, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/troubleshooting-saml2-token-not-valid-because-validity-period-ended","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Troubleshooting guidelines for SAML2 token errors that can occur when using Microsoft Entra ID or Office authentication","date":"2021-04-01","meta":{"topic":"troubleshooting-general"},"outline":[{"level":1,"title":"Troubleshooting: SAML2 token errors with Microsoft Entra ID / Office 365 Authentication","slug":"troubleshooting-saml2-token-errors-with-microsoft-entra-id-office-365-authentication","at":0,"chars":2118},{"level":2,"title":"Troubleshooting: The SAML2 token is not valid because its validity period has ended","slug":"troubleshooting-the-saml2-token-is-not-valid-because-its-validity-period-has-ended","at":268,"chars":1145},{"level":3,"title":"Cause","slug":"cause","at":680,"chars":206},{"level":3,"title":"Resolution","slug":"resolution","at":886,"chars":527},{"level":2,"title":"ID4148: The Saml2SecurityToken is rejected because the SAML2:Assertion's NotOnOrAfter condition is not satisfied","slug":"id4148-the-saml2securitytoken-is-rejected-because-the-saml2assertions-notonorafter-condition-is-not-satisfied","at":1413,"chars":508},{"level":3,"title":"Cause","slug":"cause-1","at":1725,"chars":144},{"level":3,"title":"Resolution","slug":"resolution-1","at":1869,"chars":52},{"level":2,"title":"Related information","slug":"related-information","at":1921,"chars":197}],"text":"# Troubleshooting: SAML2 token errors with Microsoft Entra ID / Office 365 Authentication\nThis article provides troubleshooting guidelines for SAML2 token errors that users might experience when your deployment's using Microsoft Entra ID or Office 365 Authentication.\n## Troubleshooting: The SAML2 token is not valid because its validity period has ended\nWhen using Microsoft Entra authentication, while working in the client, users get an error similar to the following message:\nConnection is not longer available or was lost\nThe event log includes the following error for the Business Central Server instance:\nThe SAML2 token is not valid because its validity period has ended.\n### Cause\nThis error occurs because the security token that's used by Microsoft Entra ID has exceeded its specified lifetime. By default, the lifetime, which is determined by Microsoft Entra ID, is 1 hour.\n### Resolution\nThe Business Central Server includes a configuration setting called ExtendedSecurityTokenLifetime that you can set to add additional time to the security token lifetime. If this issue becomes a problem, you can increase the value of the ExtendedSecurityTokenLifetime setting. Before you do, read more about the Microsoft Entra token lifetime policies at Configurable token lifetimes in Microsoft Entra ID<https://learn.microsoft.com/azure/active-directory/develop/active-directory-configurable-token-lifetimes>.\n## ID4148: The Saml2SecurityToken is rejected because the SAML2:Assertion's NotOnOrAfter condition is not satisfied\nWhile working in the Windows client, users get an error similar to the following:\nID4148: The Saml2SecurityToken is rejected because the SAML2:Assertion's NotOnOrAfter condition is not satisfied.\n### Cause\nThe Windows client times out when it has been connected for 9 hours or more. The timeout is an internal setting and can't be changed.\n### Resolution\nClose and reopen the Windows client.\n## Related information\nAuthenticating Business Central Users with Microsoft Entra ID<authenticating-users-with-azure-active-directory>\nConfiguring Business Central Server<configure-server-instance>"}