Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

10 linesCodeBlameRaw
1/** RFC 9207: success and error responses identify the metadata's issuer. */
2export function oauthCallback(redirectUri: string, params: Record<string, string>, issuer: string): string {
3 const url = new URL(redirectUri);
4 for (const key of ["code", "error", "error_description", "state", "iss"]) url.searchParams.delete(key);
5 for (const [key, value] of Object.entries(params)) {
6 if (value) url.searchParams.set(key, value);
7 }
8 url.searchParams.set("iss", issuer);
9 return url.toString();
10}