Skip to content

fix: ensure authorization_details can be passed in as array instead of only string#1111

Draft
frederikprijck wants to merge 5 commits into
masterfrom
fix/ciba-rar
Draft

fix: ensure authorization_details can be passed in as array instead of only string#1111
frederikprijck wants to merge 5 commits into
masterfrom
fix/ciba-rar

Conversation

@frederikprijck

@frederikprijck frederikprijck commented May 16, 2025

Copy link
Copy Markdown
Member

Changes

This PR ensures we can pass authorization_details as an array instead of only a string.

Additionally, the authorization_details are not returned as a string, but as an actual array.

This PR fixes those types, and implements it using Generics so that users can provide their own type of AuthorizationDetails (which will most often be the case).

This has been fixed for both CIBA+RAR and PAR+RAR.

References

https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-initiated-backchannel-authentication-flow/user-authorization-with-ciba

Testing

To test this, simply do a CIBA+RAR exchange and inspect the returned authorization_details (even before this change, it's marked as a string but it's actually an object at run time.

  • This change adds unit test coverage
  • This change adds integration test coverage

Checklist

@frederikprijck frederikprijck requested a review from a team as a code owner May 16, 2025 09:35
Comment thread test/auth/backchannel.test.ts Outdated

it('should return token response, including authorization_details when available', async () => {
const authorization_details = JSON.stringify([{ type: 'test-type' }]);
const authorization_details = [{ type: 'test-type' }];

@frederikprijck frederikprijck May 16, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test was incorrectly configuring auth0 to return a string, so the test passed.

Comment thread src/auth/backchannel.ts Outdated
...options,
login_hint: getLoginHint(userId, this.domain),
client_id: this.clientId,
authorization_details:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to avoid sending it when not defined

@frederikprijck frederikprijck changed the title fix: ensure authorization_details is correctly returned as an array fix: ensure authorization_details can be passed in as array instead of only string May 16, 2025
@tanya732

Copy link
Copy Markdown
Contributor

Hi @frederikprijck

Could you please update the PR when you get a chance?
Thank you

@ankita10119 ankita10119 marked this pull request as draft June 15, 2026 10:13
@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

…edupe type

- Make grant() and all TokenSet-returning grant methods generic over
  TAuthorizationDetails so PAR+RAR custom types work end to end
- Avoid mutating caller input in pushedAuthorization
- Share a single exported AuthorizationDetails type across auth modules
- Add test for array authorization_details serialization in Backchannel.authorize
Make IBackchannel.authorize and backchannelGrant generic so the
TAuthorizationDetails type parameter is reachable via auth0.backchannel,
not only when instantiating the Backchannel class directly.
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