From a39f7508751d17fdfe62abb225ded44dd9a86b5a Mon Sep 17 00:00:00 2001 From: Mateusz Pietryga Date: Sun, 14 Apr 2024 23:37:14 +0200 Subject: [PATCH] Fix: OAuth2: Supported at the request level, but not at the collection level #1704 --- .../src/components/RequestPane/Auth/index.js | 28 ++++++------------- .../src/ipc/network/prepare-request.js | 3 ++ 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/packages/bruno-app/src/components/RequestPane/Auth/index.js b/packages/bruno-app/src/components/RequestPane/Auth/index.js index 51a1450f1e..3a988b4375 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/index.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/index.js @@ -6,8 +6,9 @@ import BearerAuth from './BearerAuth'; import BasicAuth from './BasicAuth'; import DigestAuth from './DigestAuth'; import StyledWrapper from './StyledWrapper'; -import { humanizeRequestAuthMode } from 'utils/collections/index'; +import { humanizeRequestAuthMode } from 'utils/collections'; import OAuth2 from './OAuth2/index'; +import CredentialsPreview from './OAuth2/CredentialsPreview'; const Auth = ({ item, collection }) => { const authMode = item.draft ? get(item, 'draft.request.auth.mode') : get(item, 'request.auth.mode'); @@ -34,24 +35,13 @@ const Auth = ({ item, collection }) => { } case 'inherit': { return ( -
- {collectionAuth?.mode === 'oauth2' ? ( -
-
-
Collection level auth is:
-
{humanizeRequestAuthMode(collectionAuth?.mode)}
-
-
- Note: You need to use scripting to set the access token in the request headers. -
-
- ) : ( - <> -
Auth inherited from the Collection:
-
{humanizeRequestAuthMode(collectionAuth?.mode)}
- - )} -
+ <> +
+
Auth inherited from the Collection:
+
{humanizeRequestAuthMode(collectionAuth?.mode)}
+
+ {collectionAuth?.mode === 'oauth2' && } + ); } } diff --git a/packages/bruno-electron/src/ipc/network/prepare-request.js b/packages/bruno-electron/src/ipc/network/prepare-request.js index a420ddae99..c58e53d708 100644 --- a/packages/bruno-electron/src/ipc/network/prepare-request.js +++ b/packages/bruno-electron/src/ipc/network/prepare-request.js @@ -59,6 +59,9 @@ const setAuthHeaders = (axiosRequest, request, collectionRoot) => { password: get(collectionAuth, 'digest.password') }; break; + case 'oauth2': + request.auth = collectionAuth; + break; } }