fast-soccer-4548
07/08/2025, 3:29 PMbrief-egg-61061
07/08/2025, 3:29 PMbrief-egg-61061
07/08/2025, 3:29 PMory patch oauth2-config {project.id} \ --replace '/strategies/jwt/scope_claim="list"'
If you want both "scope" and "scp" claims, use: ory patch oauth2-config {project.id} \ --replace '/strategies/jwt/scope_claim="both"'
This allows you to control the format and key of the scope claim in your JWT access tokens, ensuring compatibility with your requirements or client libraries [Customize OpenID Connect scope and claims](https://www.ory.sh/docs/oauth2-oidc/openid-connect-claims-scope-custom). Note: There have been recent updates to this feature, and it is now available in Ory Network production environments as of late May 2024 [Github Issue: Configuration scope_claim
is not persisted in Ory Network](https://github.com/ory/network/issues/384).fast-soccer-4548
07/08/2025, 6:27 PMbrief-egg-61061
07/08/2025, 6:27 PMbrief-egg-61061
07/08/2025, 6:27 PMory patch oauth2-config {project.id} \ --replace '/strategies/jwt/scope_claim=both'
You should use: ory patch oauth2-config {project.id} \ --replace '/strategies/jwt/scope_claim="both"'
The same applies for other values like "list" or "string"—they must be wrapped in double quotes to be valid JSON strings. This is consistent with the examples in the documentation, which show the correct usage with quotes: ory patch oauth2-config {project.id} \ --replace '/strategies/jwt/scope_claim="string"'
[Customize OpenID Connect scope and claims](https://www.ory.sh/docs/oauth2-oidc/openid-connect-claims-scope-custom) If you are still seeing errors after quoting the value, it may be due to a version mismatch or a recent change not yet reflected in the documentation. However, according to the knowledge sources, quoting the value is the correct approach.fast-soccer-4548
07/08/2025, 6:29 PM> --replace '/strategies/jwt/scope_claim="both"'Error: value for /services/oauth2/config/strategies/jwt/scope_claim must be valid JSON but got: both
brief-egg-61061
07/08/2025, 6:29 PMbrief-egg-61061
07/08/2025, 6:30 PMory patch oauth2-config {project.id} \ --replace '/strategies/jwt/scope_claim="string"'
However, your error message indicates that the CLI expects the path to be /services/oauth2/config/strategies/jwt/scope_claim, not just /strategies/jwt/scope_claim. This suggests that the correct path in the patch command should be: /services/oauth2/config/strategies/jwt/scope_claim
So, your command should look like: ory patch project --project {project.id} \ --replace '/services/oauth2/config/strategies/jwt/scope_claim="both"'
or, if you are using the oauth2-config-specific command, ensure the path matches what the CLI expects for that command. The knowledge sources do not provide a direct example for the full path with the oauth2-config command, and there may be a discrepancy between the documentation and the current CLI implementation. If the error persists even with the correct path and quoting, it may indicate a recent change or a bug not yet reflected in the documentation. In that case, I recommend checking the latest CLI help output or reaching out to Ory support for clarification. In summary: - Ensure you are using the correct JSON path as expected by the CLI. - The value must be a valid JSON string (quoted). - If using ory patch project, use the full path as shown above. - If using ory patch oauth2-config, the path may be shorter, but the knowledge sources do not provide a definitive example for this case. The knowledge sources do not contain enough information to fully resolve the discrepancy between the documentation and the error you are seeing.