Login Error in Sitecore CMS via Identity Server with Azure AD Integration
You may encounter one of the following two error messages in the browser. Although the messages differ, the root cause is the same.
The root cause of this issue arises when logging into Sitecore CMS using Azure AD integration via the Sitecore Identity Server.
When you enter your Azure credentials, authentication is successfully completed by Azure AD, and an ID token is returned to Sitecore. This ID token contains claims, including the list of Azure AD groups that the user is associated with.
For most users, the login process works without issues. However, for some users—specifically those who are members of a large number of Azure AD groups—the ID token becomes excessively large due to the inclusion of all group memberships.
As a result, the request header becomes too large, leading to login failures.
1. Update the web.config in Sitecore Identity Server
-
Navigate to the Sitecore Identity Server root directory.
-
Open the
web.configfile. -
Locate the
<system.web>section and add or update the following setting:
-
After saving the file, restart the Identity Server application pool and site in IIS.
2. Modify Windows Registry Settings
-
Open the Run window (
Win + R), typeregedit, and press Enter to open the Registry Editor. -
Navigate to the following path:
-
Select the Parameters folder.
-
Right-click in the right panel and create the following two DWORD (32-bit) Values:
-
MaxFieldLength→ set the value to 32768 (Decimal) -
MaxRequestBytes→ set the value to 32768 (Decimal)
-
đĄ These values increase the allowed size for HTTP request headers, which prevents the token size issue for users with many Azure AD group memberships.
3. Restart the Identity Server
-
After completing the above steps, restart the Identity Server to apply the new registry settings.
-
If you skip this step, the new registry keys will not take effect.
⚠️ Important Note
You may find some documentation or solutions suggesting only updating the web.config file, but that alone will not resolve the issue. All three steps above must be completed for the fix to be effective.
Comments
Post a Comment