nanndekowareta2
This commit is contained in:
parent
ae7b59282c
commit
7f79227467
|
@ -104,19 +104,27 @@ interface ClientInformation {
|
||||||
async function discoverClientInformation(httpRequestService: HttpRequestService, id: string): Promise<ClientInformation> {
|
async function discoverClientInformation(httpRequestService: HttpRequestService, id: string): Promise<ClientInformation> {
|
||||||
try {
|
try {
|
||||||
const res = await httpRequestService.send(id);
|
const res = await httpRequestService.send(id);
|
||||||
|
console.log('TEST', 'marker1');
|
||||||
const redirectUris: string[] = [];
|
const redirectUris: string[] = [];
|
||||||
|
|
||||||
const linkHeader = res.headers.get('link');
|
const linkHeader = res.headers.get('link');
|
||||||
if (linkHeader) {
|
if (linkHeader) {
|
||||||
redirectUris.push(...httpLinkHeader.parse(linkHeader).get('rel', 'redirect_uri').map(r => r.uri));
|
redirectUris.push(...httpLinkHeader.parse(linkHeader).get('rel', 'redirect_uri').map(r => r.uri));
|
||||||
}
|
}
|
||||||
|
console.log('TEST', 'marker2');
|
||||||
|
|
||||||
const fragment = JSDOM.fragment(await res.text());
|
const fragment = JSDOM.fragment(await res.text());
|
||||||
|
|
||||||
|
console.log('TEST', 'marker3');
|
||||||
|
|
||||||
redirectUris.push(...[...fragment.querySelectorAll<HTMLLinkElement>('link[rel=redirect_uri][href]')].map(el => el.href));
|
redirectUris.push(...[...fragment.querySelectorAll<HTMLLinkElement>('link[rel=redirect_uri][href]')].map(el => el.href));
|
||||||
|
|
||||||
|
console.log('TEST', 'marker4');
|
||||||
|
|
||||||
const name = fragment.querySelector<HTMLElement>('.h-app .p-name')?.textContent?.trim() ?? id;
|
const name = fragment.querySelector<HTMLElement>('.h-app .p-name')?.textContent?.trim() ?? id;
|
||||||
|
|
||||||
|
console.log('TEST', 'marker5');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
redirectUris: redirectUris.map(uri => new URL(uri, res.url).toString()),
|
redirectUris: redirectUris.map(uri => new URL(uri, res.url).toString()),
|
||||||
|
|
|
@ -243,7 +243,6 @@ describe('OAuth', () => {
|
||||||
code_challenge: pkceAlice.code_challenge,
|
code_challenge: pkceAlice.code_challenge,
|
||||||
code_challenge_method: 'S256',
|
code_challenge_method: 'S256',
|
||||||
} as AuthorizationParamsExtended));
|
} as AuthorizationParamsExtended));
|
||||||
console.log(await responseAlice.text(), 'なんでこわれた');
|
|
||||||
assert.strictEqual(responseAlice.status, 200);
|
assert.strictEqual(responseAlice.status, 200);
|
||||||
|
|
||||||
const responseBob = await fetch(client.authorizeURL({
|
const responseBob = await fetch(client.authorizeURL({
|
||||||
|
|
Loading…
Reference in New Issue