mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-22 20:25:38 +00:00
fix: update OAuth2 authorization header encoding to remove unnecessary URI encoding (#6263)
This commit is contained in:
@@ -252,7 +252,7 @@ const getOAuth2TokenUsingAuthorizationCode = async ({ request, collectionUid, fo
|
||||
'Accept': 'application/json',
|
||||
};
|
||||
if (credentialsPlacement === "basic_auth_header") {
|
||||
axiosRequestConfig.headers['Authorization'] = `Basic ${Buffer.from(`${encodeURIComponent(clientId)}:${encodeURIComponent(clientSecret)}`).toString('base64')}`;
|
||||
axiosRequestConfig.headers['Authorization'] = `Basic ${Buffer.from(`${clientId}:${clientSecret}`).toString('base64')}`;
|
||||
}
|
||||
const data = {
|
||||
grant_type: 'authorization_code',
|
||||
@@ -451,7 +451,7 @@ const getOAuth2TokenUsingClientCredentials = async ({ request, collectionUid, fo
|
||||
'Accept': 'application/json',
|
||||
};
|
||||
if (credentialsPlacement === "basic_auth_header" && clientSecret && clientSecret.trim() !== '') {
|
||||
axiosRequestConfig.headers['Authorization'] = `Basic ${Buffer.from(`${encodeURIComponent(clientId)}:${encodeURIComponent(clientSecret)}`).toString('base64')}`;
|
||||
axiosRequestConfig.headers['Authorization'] = `Basic ${Buffer.from(`${clientId}:${clientSecret}`).toString('base64')}`;
|
||||
}
|
||||
const data = {
|
||||
grant_type: 'client_credentials',
|
||||
@@ -598,7 +598,7 @@ const getOAuth2TokenUsingPasswordCredentials = async ({ request, collectionUid,
|
||||
'Accept': 'application/json',
|
||||
};
|
||||
if (credentialsPlacement === "basic_auth_header" && clientSecret && clientSecret.trim() !== '') {
|
||||
axiosRequestConfig.headers['Authorization'] = `Basic ${Buffer.from(`${encodeURIComponent(clientId)}:${encodeURIComponent(clientSecret)}`).toString('base64')}`;
|
||||
axiosRequestConfig.headers['Authorization'] = `Basic ${Buffer.from(`${clientId}:${clientSecret}`).toString('base64')}`;
|
||||
}
|
||||
const data = {
|
||||
grant_type: 'password',
|
||||
@@ -659,7 +659,7 @@ const refreshOauth2Token = async ({ requestCopy, collectionUid, certsAndProxyCon
|
||||
'Accept': 'application/json'
|
||||
};
|
||||
if (credentialsPlacement === "basic_auth_header") {
|
||||
axiosRequestConfig.headers['Authorization'] = `Basic ${Buffer.from(`${encodeURIComponent(clientId)}:${encodeURIComponent(clientSecret)}`).toString('base64')}`;
|
||||
axiosRequestConfig.headers['Authorization'] = `Basic ${Buffer.from(`${clientId}:${clientSecret}`).toString('base64')}`;
|
||||
}
|
||||
axiosRequestConfig.url = url;
|
||||
axiosRequestConfig.responseType = 'arraybuffer';
|
||||
|
||||
@@ -145,7 +145,7 @@ const fetchTokenClientCredentials = async (oauth2Config: OAuth2Config) => {
|
||||
}
|
||||
|
||||
if (credentialsPlacement === 'basic_auth_header') {
|
||||
requestConfig.headers['Authorization'] = `Basic ${Buffer.from(`${encodeURIComponent(clientId)}:${encodeURIComponent(clientSecret!)}`).toString('base64')}`;
|
||||
requestConfig.headers['Authorization'] = `Basic ${Buffer.from(`${clientId}:${clientSecret!}`).toString('base64')}`;
|
||||
}
|
||||
|
||||
if (credentialsPlacement !== 'basic_auth_header') {
|
||||
@@ -246,7 +246,7 @@ const fetchTokenPassword = async (oauth2Config: OAuth2Config) => {
|
||||
}
|
||||
|
||||
if (credentialsPlacement === 'basic_auth_header') {
|
||||
requestConfig.headers['Authorization'] = `Basic ${Buffer.from(`${encodeURIComponent(clientId)}:${encodeURIComponent(clientSecret!)}`).toString('base64')}`;
|
||||
requestConfig.headers['Authorization'] = `Basic ${Buffer.from(`${clientId}:${clientSecret!}`).toString('base64')}`;
|
||||
}
|
||||
|
||||
if (credentialsPlacement !== 'basic_auth_header') {
|
||||
|
||||
Reference in New Issue
Block a user