fix: Pass the scope conditionally for OAuth2 grant types (#2447)

Fixes: #2446.

Signed-off-by: Nicolas Nobelis <nicolas@nobelis.eu>
This commit is contained in:
Nicolas Nobelis 2024-06-19 12:32:56 +02:00 committed by GitHub
parent 3db7d54aca
commit d88bb68014
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,9 +30,11 @@ const resolveOAuth2AuthorizationCodeAccessToken = async (request, collectionUid)
redirect_uri: callbackUrl,
client_id: clientId,
client_secret: clientSecret,
scope: scope,
state: state
};
if (scope) {
data['scope'] = scope;
}
if (pkce) {
data['code_verifier'] = codeVerifier;
}
@ -88,9 +90,11 @@ const transformClientCredentialsRequest = async (request) => {
const data = {
grant_type: 'client_credentials',
client_id: clientId,
client_secret: clientSecret,
scope
client_secret: clientSecret
};
if (scope) {
data.scope = scope;
}
const url = requestCopy?.oauth2?.accessTokenUrl;
return {
data,
@ -109,9 +113,11 @@ const transformPasswordCredentialsRequest = async (request) => {
username,
password,
client_id: clientId,
client_secret: clientSecret,
scope
client_secret: clientSecret
};
if (scope) {
data.scope = scope;
}
const url = requestCopy?.oauth2?.accessTokenUrl;
return {
data,