Skip to content

Commit a5e2d09

Browse files
committed
Fix: OAuth2: Supported at the request level, but not at the collection level
#1704
1 parent bf2e4e7 commit a5e2d09

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

Diff for: packages/bruno-app/src/components/RequestPane/Auth/index.js

+9-19
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import BearerAuth from './BearerAuth';
66
import BasicAuth from './BasicAuth';
77
import DigestAuth from './DigestAuth';
88
import StyledWrapper from './StyledWrapper';
9-
import { humanizeRequestAuthMode } from 'utils/collections/index';
9+
import { humanizeRequestAuthMode } from 'utils/collections';
1010
import OAuth2 from './OAuth2/index';
11+
import CredentialsPreview from './OAuth2/CredentialsPreview';
1112

1213
const Auth = ({ item, collection }) => {
1314
const authMode = item.draft ? get(item, 'draft.request.auth.mode') : get(item, 'request.auth.mode');
@@ -34,24 +35,13 @@ const Auth = ({ item, collection }) => {
3435
}
3536
case 'inherit': {
3637
return (
37-
<div className="flex flex-row w-full mt-2 gap-2">
38-
{collectionAuth?.mode === 'oauth2' ? (
39-
<div className="flex flex-col gap-2">
40-
<div className="flex flex-row gap-1">
41-
<div>Collection level auth is: </div>
42-
<div className="inherit-mode-text">{humanizeRequestAuthMode(collectionAuth?.mode)}</div>
43-
</div>
44-
<div className="text-sm opacity-50">
45-
Note: You need to use scripting to set the access token in the request headers.
46-
</div>
47-
</div>
48-
) : (
49-
<>
50-
<div>Auth inherited from the Collection: </div>
51-
<div className="inherit-mode-text">{humanizeRequestAuthMode(collectionAuth?.mode)}</div>
52-
</>
53-
)}
54-
</div>
38+
<>
39+
<div className="flex flex-row w-full mt-2 gap-2">
40+
<div>Auth inherited from the Collection: </div>
41+
<div className="inherit-mode-text">{humanizeRequestAuthMode(collectionAuth?.mode)}</div>
42+
</div>
43+
{collectionAuth?.mode === 'oauth2' && <CredentialsPreview item={item} collection={collection} />}
44+
</>
5545
);
5646
}
5747
}

Diff for: packages/bruno-electron/src/ipc/network/prepare-request.js

+3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ const setAuthHeaders = (axiosRequest, request, collectionRoot) => {
5959
password: get(collectionAuth, 'digest.password')
6060
};
6161
break;
62+
case 'oauth2':
63+
request.auth = collectionAuth;
64+
break;
6265
}
6366
}
6467

0 commit comments

Comments
 (0)