Skip to content

Commit 493855b

Browse files
Add algorithm field to generateClientAssertionJwt api (#595)
* Add algorithm field to generateClientAssertionJwt api * Update lib/management/jwt.ts Co-authored-by: Copilot <[email protected]> * fix readme --------- Co-authored-by: Copilot <[email protected]>
1 parent 658b637 commit 493855b

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,6 +1235,7 @@ const clientAssertionRes = await descopeClient.management.jwt.generateClientAsse
12351235
['https://example.com/token'], // audience
12361236
300, // expiresIn - number of seconds the token will will be valid for
12371237
false, // Optional. flattenAudience - set the audience claim as one string instead of array of strings (for case only one audience value has given)
1238+
'RS256', // Optional. algorithm - set the signing algorithm, value should be one of 'RS256', 'RS384', 'ES384' (default is RS256)
12381239
);
12391240
// clientAssertionRes.data.jwt contains the client assertion JWT
12401241
```

lib/management/jwt.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ describe('Management JWT', () => {
298298
['https://example.com/token'],
299299
300,
300300
true,
301+
'ES384',
301302
);
302303

303304
expect(mockHttpClient.post).toHaveBeenCalledWith(apiPaths.jwt.clientAssertion, {
@@ -306,6 +307,7 @@ describe('Management JWT', () => {
306307
audience: ['https://example.com/token'],
307308
expiresIn: 300,
308309
flattenAudience: true,
310+
algorithm: 'ES384',
309311
});
310312

311313
expect(resp).toEqual({

lib/management/jwt.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ const withJWT = (httpClient: HttpClient) => ({
7979
audience: string[],
8080
expiresIn: number,
8181
flattenAudience?: boolean,
82+
algorithm?: 'RS256' | 'RS384' | 'ES384',
8283
): Promise<SdkResponse<ClientAssertionResponse>> =>
8384
transformResponse(
8485
httpClient.post(apiPaths.jwt.clientAssertion, {
@@ -87,6 +88,7 @@ const withJWT = (httpClient: HttpClient) => ({
8788
audience,
8889
expiresIn,
8990
flattenAudience,
91+
algorithm,
9092
}),
9193
),
9294
});

0 commit comments

Comments
 (0)