Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/client/src/client/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@ export interface OAuthClientProvider {
* }
*/
prepareTokenRequest?(scope?: string): URLSearchParams | Promise<URLSearchParams | undefined> | undefined;

/**
* Saves the resource URL determined during the OAuth flow.
*
* Called by {@linkcode auth} after resource URL selection so providers can
* use it in grant-specific logic (e.g., Cross-App Access token exchange).
*/
saveResourceUrl?(url: URL): void | Promise<void>;
}

export type AuthResult = 'AUTHORIZED' | 'REDIRECT';
Expand Down Expand Up @@ -422,6 +430,10 @@ async function authInternal(

const resource: URL | undefined = await selectResourceURL(serverUrl, provider, resourceMetadata);

if (resource) {
await provider.saveResourceUrl?.(resource);
}

const metadata = await discoverAuthorizationServerMetadata(authorizationServerUrl, {
fetchFn
});
Expand Down
Loading
Loading