Skip to content

Commit

Permalink
Added additional request parameter to support PAR with JAR requests (#…
Browse files Browse the repository at this point in the history
…995)

Co-authored-by: gyaneshgouraw-okta <[email protected]>
  • Loading branch information
gyaneshgouraw-okta and gyaneshgouraw-okta authored Apr 24, 2024
1 parent 6664013 commit 3bc86cb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/auth/oauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ export interface PushedAuthorizationRequest extends ClientCredentials {
*/
code_challenge?: string;

/**
* Allows JWT-Secured Authorization Request (JAR), when JAR & PAR request are used together. {@link https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow/authorization-code-flow-with-par-and-jar | Reference}
*/
request?: string;

/**
* A JSON stringified array of objects. It can carry fine-grained authorization data in OAuth messages as part of Rich Authorization Requests (RAR) {@link https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow/authorization-code-flow-with-rar | Reference}
*/
Expand Down
11 changes: 11 additions & 0 deletions test/auth/fixtures/oauth.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,16 @@
"request_uri": "https://www.request.uri",
"expires_in": 86400
}
},
{
"scope": "https://test-domain.auth0.com",
"method": "POST",
"path": "/oauth/par",
"body": "client_id=test-client-id&response_type=code&redirect_uri=https%3A%2F%2Fexample.com&request=my-jwt-request&client_secret=test-client-secret",
"status": 200,
"response": {
"request_uri": "https://www.request.uri",
"expires_in": 86400
}
}
]
17 changes: 17 additions & 0 deletions test/auth/oauth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,23 @@ describe('OAuth', () => {
},
});
});

it('should send request param when provided', async () => {
const oauth = new OAuth(opts);
await expect(
oauth.pushedAuthorization({
client_id: 'test-client-id',
response_type: 'code',
redirect_uri: 'https://example.com',
request: 'my-jwt-request',
})
).resolves.toMatchObject({
data: {
request_uri: 'https://www.request.uri',
expires_in: 86400,
},
});
});
});
});

Expand Down

0 comments on commit 3bc86cb

Please sign in to comment.