Okta Error: "The groups claim matched too many groups and must be configured to match fewer groups"
Last Updated:
Overview
A groups claim error occurs when a user belongs to more than 100 groups because Okta limits the claim to 100 groups in most flows. Resolve this issue by distributing the user groups across multiple claims using claim expressions or by switching to the Authorization Code Flow or Interaction Code Flow. When Okta processes a groups claim for a user who belongs to more than 100 groups, Okta generates the following error:
The groups claim matched too many groups and must be configured to match fewer groups
Applies To
- Okta Identity Engine (OIE)
- Okta Classic Engine
- Group Claims
- Okta Expression Language
- Implicit Flow
Cause
In most flows, the Groups claim returns a maximum of 100 groups for a user. If a user belongs to more than 100 groups, Okta cannot return the full list in a single claim, which triggers the error.
Solution
How is the groups claim error resolved?
Distribute the user groups across multiple claims using claim expressions that include a pattern check to filter the groups and return a specific subset.
For example, an administrator could create three separate claims:
- Claim 1 Name: ad_groups
- Expression Logic:
Groups.startsWith("active_directory","ad_",100)
- Expression Logic:
- Claim 2 Name: finance_groups
- Expression Logic:
Groups.contains("OKTA","finance",100)
- Expression Logic:
- Claim 3 Name: sales_groups
- Expression Logic:
Groups.contains("active_directory","sales",100)
- Expression Logic:
Refer to the Okta Expression Language overview documentation for more information on available functions.
NOTE: Authorization Code Flow and Interaction Code Flow do not have this limitation, so another option is to switch to one of those flows instead.
