mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-18 06:49:50 +02:00
Add audience parameter to OAuth 2
Closes https://feedback.yaak.app/p/how-do-i-send-an-audience-using-oauth2
This commit is contained in:
@@ -11,6 +11,7 @@ export function getImplicit(
|
||||
redirectUri,
|
||||
scope,
|
||||
state,
|
||||
audience,
|
||||
}: {
|
||||
authorizationUrl: string;
|
||||
responseType: string;
|
||||
@@ -18,6 +19,7 @@ export function getImplicit(
|
||||
redirectUri: string | null;
|
||||
scope: string | null;
|
||||
state: string | null;
|
||||
audience: string | null;
|
||||
},
|
||||
) :Promise<AccessToken> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
@@ -34,6 +36,7 @@ export function getImplicit(
|
||||
if (redirectUri) authorizationUrl.searchParams.set('redirect_uri', redirectUri);
|
||||
if (scope) authorizationUrl.searchParams.set('scope', scope);
|
||||
if (state) authorizationUrl.searchParams.set('state', state);
|
||||
if (audience) authorizationUrl.searchParams.set('audience', audience);
|
||||
if (responseType.includes('id_token')) {
|
||||
authorizationUrl.searchParams.set('nonce', String(Math.floor(Math.random() * 9999999999999) + 1));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user