global update and global fix
This commit is contained in:
@@ -39,3 +39,18 @@ export function buildOAuthEndpoints(apiBase: string): OAuthEndpoints {
|
||||
jwksUrl: `${base}/.well-known/jwks.json`
|
||||
};
|
||||
}
|
||||
|
||||
export function buildAuthorizeUrl(
|
||||
apiBase: string,
|
||||
params: { clientId: string; redirectUri: string; scope: string; state?: string; codeChallenge?: string; codeChallengeMethod?: string }
|
||||
) {
|
||||
const url = new URL(`${normalizeBaseUrl(apiBase)}/oauth/authorize`);
|
||||
url.searchParams.set('client_id', params.clientId);
|
||||
url.searchParams.set('redirect_uri', params.redirectUri);
|
||||
url.searchParams.set('response_type', 'code');
|
||||
url.searchParams.set('scope', params.scope);
|
||||
if (params.state) url.searchParams.set('state', params.state);
|
||||
if (params.codeChallenge) url.searchParams.set('code_challenge', params.codeChallenge);
|
||||
if (params.codeChallengeMethod) url.searchParams.set('code_challenge_method', params.codeChallengeMethod);
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user