mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-05-18 19:09:52 +00:00
feat: add OpenID Connect prompt Parameter Handling (#1299)
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Elias Schneider <login@eliasschneider.com>
This commit is contained in:
@@ -1,5 +1,34 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
export async function interceptCallbackRedirect(
|
||||
page: Page,
|
||||
callbackPath: string,
|
||||
action: () => Promise<void>,
|
||||
timeoutMs: number = 10000
|
||||
): Promise<URL> {
|
||||
const routeMatcher = (url: URL) => url.pathname === callbackPath;
|
||||
|
||||
const callbackPromise = new Promise<URL>((resolve, reject) => {
|
||||
const timer = setTimeout(
|
||||
() => reject(new Error(`Timed out waiting for redirect to ${callbackPath}`)),
|
||||
timeoutMs
|
||||
);
|
||||
|
||||
page.route(routeMatcher, async (route) => {
|
||||
clearTimeout(timer);
|
||||
resolve(new URL(route.request().url()));
|
||||
await route.abort();
|
||||
});
|
||||
});
|
||||
|
||||
try {
|
||||
await action();
|
||||
return await callbackPromise;
|
||||
} finally {
|
||||
await page.unroute(routeMatcher);
|
||||
}
|
||||
}
|
||||
|
||||
export async function getUserCode(
|
||||
page: Page,
|
||||
clientId: string,
|
||||
|
||||
Reference in New Issue
Block a user