Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/insomnia-sdk/src/objects/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,11 @@ export function fromPreRequestAuth(auth: RequestAuth): RequestAuthentication {

const responseType = ((): OAuth2ResponseType => {
const inputResponseType = findValueInOauth2Options('response_type', authObj.oauth2);
if (['code', 'id_token', 'id_token token', 'none', 'token'].includes(inputResponseType)) {
// responseType is currently always set to '' in our request auth model, this should be investigated what is correct to be set
if (['code', 'id_token', 'id_token token', 'none', 'token', ''].includes(inputResponseType)) {
return inputResponseType as OAuth2ResponseType;
};
throw Error(`unknown response type for oauth2: "${inputResponseType}", it could be: 'code' | 'id_token' | 'id_token token' | 'none' | 'token'`);
throw Error(`unknown response type for oauth2: "${inputResponseType}", it could be: 'code' | 'id_token' | 'id_token token' | 'none' | 'token' | ''`);
})();

return {
Expand Down
3 changes: 0 additions & 3 deletions packages/insomnia/src/main/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const analytics = new Analytics({
writeKey: getSegmentWriteKey(),
httpClient: {
makeRequest(_options) {
console.log('makeRequest', _options);
return net.fetch(_options.url, {
method: _options.method,
headers: _options.headers,
Expand Down Expand Up @@ -65,7 +64,6 @@ export async function trackSegmentEvent(
const settings = await models.settings.getOrCreate();
const userSession = await models.userSession.getOrCreate();
const allowAnalytics = settings.enableAnalytics || userSession?.accountId;
console.log('allowAnalytics', allowAnalytics, settings.enableAnalytics, userSession?.accountId);
if (allowAnalytics) {
try {
const anonymousId = await getDeviceId() ?? '';
Expand Down Expand Up @@ -96,7 +94,6 @@ export async function trackPageView(name: string) {
const userSession = await models.userSession.getOrCreate();

const allowAnalytics = settings.enableAnalytics || userSession?.accountId;
console.log('allowAnalytics', allowAnalytics, settings.enableAnalytics, userSession?.accountId);
if (allowAnalytics) {
try {
const anonymousId = await getDeviceId() ?? '';
Expand Down
15 changes: 10 additions & 5 deletions packages/insomnia/src/ui/components/dropdowns/auth-dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,18 @@ export const AuthDropdown: FC<Props> = ({ authentication, authTypes = defaultTyp
const { requestId, requestGroupId } = useParams() as { organizationId: string; projectId: string; workspaceId: string; requestId?: string; requestGroupId?: string };
const patchRequest = useRequestPatcher();
const patchRequestGroup = useRequestGroupPatcher();
const onClick = useCallback(async (type?: AuthTypes) => {
const clickedSameSetting = type === getAuthObjectOrNull(authentication)?.type;
const onClick = useCallback(async (type: AuthTypes | 'inherit') => {
const clickedSameSetting = type === getAuthObjectOrNull(authentication)?.type || '';
if (clickedSameSetting) {
return;
}
const newAuthentication = type ? castOneAuthTypeToAnother(type, authentication || {}) : {};
const selectedInherit = type === 'inherit';
const newAuthentication = selectedInherit ? {} : castOneAuthTypeToAnother(type, authentication || {});
requestId && patchRequest(requestId, { authentication: newAuthentication });
requestGroupId && patchRequestGroup(requestGroupId, { authentication: newAuthentication });
}, [authentication, patchRequest, patchRequestGroup, requestGroupId, requestId]);

const selectedAuthType = getAuthObjectOrNull(authentication)?.type || 'none';
const selectedAuthType = getAuthObjectOrNull(authentication)?.type || 'inherit';

const authTypesItems: {
id: AuthTypes;
Expand Down Expand Up @@ -206,7 +207,7 @@ export const AuthDropdown: FC<Props> = ({ authentication, authTypes = defaultTyp
icon: IconName;
name: string;
items: {
id: AuthTypes;
id: AuthTypes | 'inherit';
name: string;
}[];
}[] = [
Expand All @@ -225,6 +226,10 @@ export const AuthDropdown: FC<Props> = ({ authentication, authTypes = defaultTyp
id: 'none',
name: 'None',
},
{
id: 'inherit',
name: 'Inherit from parent',
},
],
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3833,6 +3833,7 @@ exports[`Fixtures Import postman api-key-default-v2_1-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -3875,6 +3876,7 @@ exports[`Fixtures Import postman api-key-header-v2_1-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -3917,6 +3919,7 @@ exports[`Fixtures Import postman api-key-queryParams-v2_1-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -3959,6 +3962,7 @@ exports[`Fixtures Import postman aws-signature-auth-v2_0-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "A collection for testing",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -4003,6 +4007,7 @@ exports[`Fixtures Import postman aws-signature-auth-v2_1-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "A collection for testing",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -4047,6 +4052,7 @@ exports[`Fixtures Import postman basic-auth-v2_0-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "A collection for testing",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -4088,6 +4094,7 @@ exports[`Fixtures Import postman basic-auth-v2_1-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "A collection for testing",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -4129,6 +4136,7 @@ exports[`Fixtures Import postman bearer-token-v2_0-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "A collection for testing",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -4170,6 +4178,7 @@ exports[`Fixtures Import postman bearer-token-v2_1-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "A collection for testing",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -4211,6 +4220,7 @@ exports[`Fixtures Import postman complex-url-v2_0-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "A collection for testing",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -4253,6 +4263,7 @@ exports[`Fixtures Import postman complex-url-v2_1-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "A collection for testing",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -4295,6 +4306,7 @@ exports[`Fixtures Import postman complex-v2_0_fromHeaders-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "",
"environment": {},
"metaSortKey": -1622117984000,
Expand All @@ -4305,6 +4317,7 @@ exports[`Fixtures Import postman complex-v2_0_fromHeaders-input.json 1`] = `
"_id": "__GRP_2__",
"_type": "request_group",
"afterResponseScript": "",
"authentication": {},
"description": "",
"environment": {},
"metaSortKey": -1622117983999,
Expand Down Expand Up @@ -4557,6 +4570,7 @@ exports[`Fixtures Import postman complex-v2_0-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "A collection for testing",
"environment": {},
"metaSortKey": -1622117984000,
Expand All @@ -4567,6 +4581,7 @@ exports[`Fixtures Import postman complex-v2_0-input.json 1`] = `
"_id": "__GRP_2__",
"_type": "request_group",
"afterResponseScript": "",
"authentication": {},
"description": "The first folder",
"environment": {},
"metaSortKey": -1622117983999,
Expand Down Expand Up @@ -4725,6 +4740,7 @@ exports[`Fixtures Import postman complex-v2_1-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "A collection for testing",
"environment": {},
"metaSortKey": -1622117984000,
Expand All @@ -4735,6 +4751,7 @@ exports[`Fixtures Import postman complex-v2_1-input.json 1`] = `
"_id": "__GRP_2__",
"_type": "request_group",
"afterResponseScript": "",
"authentication": {},
"description": "The first folder",
"environment": {},
"metaSortKey": -1622117983999,
Expand Down Expand Up @@ -4899,6 +4916,7 @@ exports[`Fixtures Import postman digest-auth-v2_0-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "A collection for testing",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -4940,6 +4958,7 @@ exports[`Fixtures Import postman digest-auth-v2_1-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "A collection for testing",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -4981,6 +5000,7 @@ exports[`Fixtures Import postman faker-vars-v2_1-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -5037,6 +5057,7 @@ exports[`Fixtures Import postman minimal-v2_0-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "A collection for testing",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -5073,6 +5094,7 @@ exports[`Fixtures Import postman minimal-v2_1-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "A collection for testing",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -5109,6 +5131,7 @@ exports[`Fixtures Import postman oauth1_0-auth-v2_0-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "A collection for testing",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -5284,6 +5307,7 @@ exports[`Fixtures Import postman oauth1_0-auth-v2_1-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "A collection for testing",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -5459,6 +5483,7 @@ exports[`Fixtures Import postman oauth2_0-auth-v2_0-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "A collection for testing",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -5527,6 +5552,7 @@ exports[`Fixtures Import postman oauth2_0-auth-v2_1-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -5712,6 +5738,7 @@ exports[`Fixtures Import postman postman-export-oauth2-v2_1-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -5765,6 +5792,7 @@ exports[`Fixtures Import postman scripts-import-v2_1-input.json 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "",
"environment": {},
"metaSortKey": -1622117984000,
Expand Down Expand Up @@ -8139,6 +8167,7 @@ exports[`Fixtures Import wsdl addition-input.wsdl 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "",
"environment": {},
"metaSortKey": -1622117984000,
Expand All @@ -8149,6 +8178,7 @@ exports[`Fixtures Import wsdl addition-input.wsdl 1`] = `
"_id": "__GRP_2__",
"_type": "request_group",
"afterResponseScript": "",
"authentication": {},
"description": "",
"environment": {},
"metaSortKey": -1622117983999,
Expand Down Expand Up @@ -8225,6 +8255,7 @@ exports[`Fixtures Import wsdl calculator-input.wsdl 1`] = `
{
"_id": "__GRP_1__",
"_type": "request_group",
"authentication": {},
"description": "",
"environment": {},
"metaSortKey": -1622117984000,
Expand All @@ -8235,6 +8266,7 @@ exports[`Fixtures Import wsdl calculator-input.wsdl 1`] = `
"_id": "__GRP_2__",
"_type": "request_group",
"afterResponseScript": "",
"authentication": {},
"description": "",
"environment": {},
"metaSortKey": -1622117983999,
Expand Down
Loading