Merge pull request #4987 from naman-bruno/bugfix/oauth2-scope

Remove scope parameter from token request when empty
This commit is contained in:
lohit
2025-06-27 15:13:03 +05:30
committed by GitHub

View File

@@ -141,7 +141,7 @@ const getOAuth2TokenUsingAuthorizationCode = async ({ request, collectionUid, fo
if (pkce) {
data['code_verifier'] = codeVerifier;
}
if (scope) {
if (scope && scope.trim() !== '') {
data.scope = scope;
}
requestCopy.data = qs.stringify(data);
@@ -344,7 +344,7 @@ const getOAuth2TokenUsingClientCredentials = async ({ request, collectionUid, fo
if (clientSecret && credentialsPlacement !== "basic_auth_header") {
data.client_secret = clientSecret;
}
if (scope) {
if (scope && scope.trim() !== '') {
data.scope = scope;
}
requestCopy.data = qs.stringify(data);
@@ -515,7 +515,7 @@ const getOAuth2TokenUsingPasswordCredentials = async ({ request, collectionUid,
if (clientSecret && credentialsPlacement !== "basic_auth_header") {
data.client_secret = clientSecret;
}
if (scope) {
if (scope && scope.trim() !== '') {
data.scope = scope;
}
requestCopy.data = qs.stringify(data);