diff --git a/test/auth/fixtures/oauth.json b/test/auth/fixtures/oauth.json index 0c8e4ac6f..7f2a80198 100644 --- a/test/auth/fixtures/oauth.json +++ b/test/auth/fixtures/oauth.json @@ -167,5 +167,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=eyJhbGciOiJSUzI1NiIsInR5cCI6Imp3dCIsImtpZCI6IjNreHdsVm5ZdW5oVUIyQVFYLVFYVUVZV0oxSlRyd08tQUpBMmc3MVVfa0UifQ.eyJpc3MiOiJkUkRDaWNobkk1YUpLcHZqYVJNZG0yUWdTRUxycVlHVSIsImF1ZCI6Imh0dHBzOi8vcGV1Mi10ZXN0LmV1LmF1dGgwLmNvbS8iLCJjbGllbnRfaWQiOiJkUkRDaWNobkk1YUpLcHZqYVJNZG0yUWdTRUxycVlHVSIsInJlc3BvbnNlX3R5cGUiOiJjb2RlIiwicmVkaXJlY3RfdXJpIjoiaHR0cDovL2xvY2FsaG9zdDozMDAwIiwibm9uY2UiOiIzMjNmMWYxNDIxMjI3Y2U1OGE3M2IxOTVkZWRjMDRmOCIsImlhdCI6MTcxMjMzNTMyMn0.E9ZAju2emT9KyR-asklRydgT0q2GmL3u90enSHvpF1PVn7zKqHBW9i6o4-QlIy-efHAsaGikMsysRMbp2xNVl5p9SFn-mZXlxrtIe2vKwbIRrknCT29CRyxX7Ulvv9840YK7N8BHoah8PRuAfJMq-e0jvCgfxuxBJC8uXBY2S43_YpLe2SKkmb-E9APwKh-55Mx-DPFVUKm1hasZ9GnRSZUb9F4aVB9Q8YndZ0uxKSjtPPwakDECHxSyA1yXQ7B1FrhcsZcTwneTDbmzepodStNboBdxmDVjXQggfyPeqeeeW5cCpJAhVnoo740TjwgsncJ9ftymR2uLP_fexru6KA&client_secret=test-client-secret", + "status": 200, + "response": { + "request_uri": "https://www.request.uri", + "expires_in": 86400 + } } ] diff --git a/test/auth/oauth.test.ts b/test/auth/oauth.test.ts index ec61fc9f3..f6b4cb1a2 100644 --- a/test/auth/oauth.test.ts +++ b/test/auth/oauth.test.ts @@ -328,6 +328,24 @@ 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: + 'eyJhbGciOiJSUzI1NiIsInR5cCI6Imp3dCIsImtpZCI6IjNreHdsVm5ZdW5oVUIyQVFYLVFYVUVZV0oxSlRyd08tQUpBMmc3MVVfa0UifQ.eyJpc3MiOiJkUkRDaWNobkk1YUpLcHZqYVJNZG0yUWdTRUxycVlHVSIsImF1ZCI6Imh0dHBzOi8vcGV1Mi10ZXN0LmV1LmF1dGgwLmNvbS8iLCJjbGllbnRfaWQiOiJkUkRDaWNobkk1YUpLcHZqYVJNZG0yUWdTRUxycVlHVSIsInJlc3BvbnNlX3R5cGUiOiJjb2RlIiwicmVkaXJlY3RfdXJpIjoiaHR0cDovL2xvY2FsaG9zdDozMDAwIiwibm9uY2UiOiIzMjNmMWYxNDIxMjI3Y2U1OGE3M2IxOTVkZWRjMDRmOCIsImlhdCI6MTcxMjMzNTMyMn0.E9ZAju2emT9KyR-asklRydgT0q2GmL3u90enSHvpF1PVn7zKqHBW9i6o4-QlIy-efHAsaGikMsysRMbp2xNVl5p9SFn-mZXlxrtIe2vKwbIRrknCT29CRyxX7Ulvv9840YK7N8BHoah8PRuAfJMq-e0jvCgfxuxBJC8uXBY2S43_YpLe2SKkmb-E9APwKh-55Mx-DPFVUKm1hasZ9GnRSZUb9F4aVB9Q8YndZ0uxKSjtPPwakDECHxSyA1yXQ7B1FrhcsZcTwneTDbmzepodStNboBdxmDVjXQggfyPeqeeeW5cCpJAhVnoo740TjwgsncJ9ftymR2uLP_fexru6KA', + }) + ).resolves.toMatchObject({ + data: { + request_uri: 'https://www.request.uri', + expires_in: 86400, + }, + }); + }); }); });