From 7f792274675b0ae34988621add7ed1417bc0ab3e Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 29 Jun 2023 01:10:41 +0200 Subject: [PATCH] nanndekowareta2 --- .../backend/src/server/oauth/OAuth2ProviderService.ts | 8 ++++++++ packages/backend/test/e2e/oauth.ts | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/server/oauth/OAuth2ProviderService.ts b/packages/backend/src/server/oauth/OAuth2ProviderService.ts index a4fcb7cea6..22b1a7400a 100644 --- a/packages/backend/src/server/oauth/OAuth2ProviderService.ts +++ b/packages/backend/src/server/oauth/OAuth2ProviderService.ts @@ -104,19 +104,27 @@ interface ClientInformation { async function discoverClientInformation(httpRequestService: HttpRequestService, id: string): Promise { try { const res = await httpRequestService.send(id); + console.log('TEST', 'marker1'); const redirectUris: string[] = []; const linkHeader = res.headers.get('link'); if (linkHeader) { redirectUris.push(...httpLinkHeader.parse(linkHeader).get('rel', 'redirect_uri').map(r => r.uri)); } + console.log('TEST', 'marker2'); const fragment = JSDOM.fragment(await res.text()); + console.log('TEST', 'marker3'); + redirectUris.push(...[...fragment.querySelectorAll('link[rel=redirect_uri][href]')].map(el => el.href)); + console.log('TEST', 'marker4'); + const name = fragment.querySelector('.h-app .p-name')?.textContent?.trim() ?? id; + console.log('TEST', 'marker5'); + return { id, redirectUris: redirectUris.map(uri => new URL(uri, res.url).toString()), diff --git a/packages/backend/test/e2e/oauth.ts b/packages/backend/test/e2e/oauth.ts index c10f52cc04..3762762ebc 100644 --- a/packages/backend/test/e2e/oauth.ts +++ b/packages/backend/test/e2e/oauth.ts @@ -243,7 +243,6 @@ describe('OAuth', () => { code_challenge: pkceAlice.code_challenge, code_challenge_method: 'S256', } as AuthorizationParamsExtended)); - console.log(await responseAlice.text(), 'なんでこわれた'); assert.strictEqual(responseAlice.status, 200); const responseBob = await fetch(client.authorizeURL({