mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-27 11:51:29 +01:00
Better authorization URL handling
This commit is contained in:
@@ -52,7 +52,12 @@ export async function getAuthorizationCode(
|
||||
return token;
|
||||
}
|
||||
|
||||
const authorizationUrl = new URL(`${authorizationUrlRaw ?? ''}`);
|
||||
let authorizationUrl: URL;
|
||||
try {
|
||||
authorizationUrl = new URL(`${authorizationUrlRaw ?? ''}`);
|
||||
} catch {
|
||||
throw new Error('Invalid authorization URL: ' + authorizationUrlRaw);
|
||||
}
|
||||
authorizationUrl.searchParams.set('response_type', 'code');
|
||||
authorizationUrl.searchParams.set('client_id', clientId);
|
||||
if (redirectUri) authorizationUrl.searchParams.set('redirect_uri', redirectUri);
|
||||
|
||||
Reference in New Issue
Block a user