Skip to content

Conversation

@ejazkhan172
Copy link

bug fix for #4043
Ory hydra altering scopes in JWT token claims when requested scope contains a pipe '|'

Issue : when scopes contains pipe '|' while executing auth code workflow (using client secret post) , example scopes :
openid offline_access abc|def
JWT token response from hydra provides scope list (claims) as "openid", "offline_access", "abc" ,"def"
its a bug , ideally hydra should return original scopes back in response.

root cause of the issue,
while generating login challenge , hydra storing the scopes (coming from request via space saparete), hydra storing these scope in table via pipe separate. i.e if request coming with scopes :

"openid offline_access abc|def"

hydra storing them with pipe separate as requested scopes:
'openid|offline_access|abc|def'

@ejazkhan172 ejazkhan172 requested review from a team and aeneasr as code owners November 25, 2025 07:13
@CLAassistant
Copy link

CLAassistant commented Nov 25, 2025

CLA assistant check
All committers have signed the CLA.

… simplify test to focus on scope preservation
…d defaults

- Modified acceptLoginHandler to accept any RequestedScope instead of asserting hardcoded default scopes
- Modified acceptConsentHandler to grant requested scopes verbatim (GrantScope: rr.RequestedScope) instead of hardcoded defaults
- This allows scopes containing pipe characters (e.g., patient|read) to be preserved through the OAuth2 flow
- Enables FHIR OAuth2 compliance and ONC g(10) certification support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants