Skip to content

Commit 50a5d16

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

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

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

+9-17
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,22 +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">Cannot inherit Oauth2 from collection.</div>
45-
</div>
46-
) : (
47-
<>
48-
<div>Auth inherited from the Collection: </div>
49-
<div className="inherit-mode-text">{humanizeRequestAuthMode(collectionAuth?.mode)}</div>
50-
</>
51-
)}
52-
</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+
</>
5345
);
5446
}
5547
}

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

+3
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ const setAuthHeaders = (axiosRequest, request, collectionRoot) => {
7070
password: get(collectionAuth, 'digest.password')
7171
};
7272
break;
73+
case 'oauth2':
74+
request.auth = collectionAuth;
75+
break;
7376
}
7477
}
7578

0 commit comments

Comments
 (0)