mirror of
https://github.com/usebruno/bruno.git
synced 2025-06-20 03:38:17 +02:00
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:
parent
3db7d54aca
commit
d88bb68014
@ -30,9 +30,11 @@ const resolveOAuth2AuthorizationCodeAccessToken = async (request, collectionUid)
|
|||||||
redirect_uri: callbackUrl,
|
redirect_uri: callbackUrl,
|
||||||
client_id: clientId,
|
client_id: clientId,
|
||||||
client_secret: clientSecret,
|
client_secret: clientSecret,
|
||||||
scope: scope,
|
|
||||||
state: state
|
state: state
|
||||||
};
|
};
|
||||||
|
if (scope) {
|
||||||
|
data['scope'] = scope;
|
||||||
|
}
|
||||||
if (pkce) {
|
if (pkce) {
|
||||||
data['code_verifier'] = codeVerifier;
|
data['code_verifier'] = codeVerifier;
|
||||||
}
|
}
|
||||||
@ -88,9 +90,11 @@ const transformClientCredentialsRequest = async (request) => {
|
|||||||
const data = {
|
const data = {
|
||||||
grant_type: 'client_credentials',
|
grant_type: 'client_credentials',
|
||||||
client_id: clientId,
|
client_id: clientId,
|
||||||
client_secret: clientSecret,
|
client_secret: clientSecret
|
||||||
scope
|
|
||||||
};
|
};
|
||||||
|
if (scope) {
|
||||||
|
data.scope = scope;
|
||||||
|
}
|
||||||
const url = requestCopy?.oauth2?.accessTokenUrl;
|
const url = requestCopy?.oauth2?.accessTokenUrl;
|
||||||
return {
|
return {
|
||||||
data,
|
data,
|
||||||
@ -109,9 +113,11 @@ const transformPasswordCredentialsRequest = async (request) => {
|
|||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
client_id: clientId,
|
client_id: clientId,
|
||||||
client_secret: clientSecret,
|
client_secret: clientSecret
|
||||||
scope
|
|
||||||
};
|
};
|
||||||
|
if (scope) {
|
||||||
|
data.scope = scope;
|
||||||
|
}
|
||||||
const url = requestCopy?.oauth2?.accessTokenUrl;
|
const url = requestCopy?.oauth2?.accessTokenUrl;
|
||||||
return {
|
return {
|
||||||
data,
|
data,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user