Skip to content

Commit ccab7c2

Browse files
feat: add support for additional authorization parameters when using CIBA
1 parent a3709da commit ccab7c2

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/auth/backchannel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export type AuthorizeOptions = {
103103
* @see https://auth0.com/docs/get-started/apis/configure-rich-authorization-requests
104104
*/
105105
authorization_details?: string;
106-
};
106+
} & Record<string, string>;
107107

108108
type AuthorizeRequest = Omit<AuthorizeOptions, 'userId'> &
109109
AuthorizeCredentialsPartial & {

test/auth/backchannel.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,29 @@ describe('Backchannel', () => {
116116
expect(receivedAuthorizationDetails[0].type).toBe('test-type');
117117
});
118118

119+
it('should pass custom parameters to /bc-authorize', async () => {
120+
let receivedCustomParam = '';
121+
nock(`https://${opts.domain}`)
122+
.post('/bc-authorize')
123+
.reply(201, (uri, requestBody, cb) => {
124+
receivedCustomParam = querystring.parse(requestBody as any)['custom_param'] as string;
125+
cb(null, {
126+
auth_req_id: 'test-auth-req-id',
127+
expires_in: 300,
128+
interval: 5,
129+
});
130+
});
131+
132+
await backchannel.authorize({
133+
userId: 'auth0|test-user-id',
134+
binding_message: 'Test binding message',
135+
scope: 'openid',
136+
custom_param: '<custom_param>',
137+
});
138+
139+
expect(receivedCustomParam).toBe('<custom_param>');
140+
});
141+
119142
it('should throw for invalid request', async () => {
120143
nock(`https://${opts.domain}`).post('/bc-authorize').reply(400, {
121144
error: 'invalid_request',

0 commit comments

Comments
 (0)