Kong / Kong/insomnia

Per-request Authorization setting does not override Authorization added by default headers plugin

Open
#3,459 2 comments 3 reactions 0 assignees View on GitHub
B-bug S-verified
Dominant language
TypeScript
Stars
40k
Forks
2.4k
Avg merge
2d 13h
Merged PRs (30d)
61

Description

**Describe the bug**
I use the [Default Headers](https://github.com/kong/insomnia/tree/master/plugins/insomnia-plugin-default-headers) plugin to workaround https://github.com/Kong/insomnia/issues/1116.

This allows me to set authorization headers at a folder level.

However, a per-request Authorization setting should clearly override the default header set at the folder level, however it does not -- the per-request Authorization settings are completely ignored.

**To Reproduce**
Steps to reproduce the behavior:
1. Install default headers plugin
2. Create a folder and set a default header:
```
{
"DEFAULT_HEADERS": {
"Authorization": "Bearer {{ _.token }}"
}
}
```
3. Create a request inside that folder, and add a Bearer authorization with a different token.
4. Make a request -- the default header auth token is sent, not the request auth token.

**Expected behavior**
I want the "default headers" to be just that: defaults. In other words, they are used only when they are not already explicitly set at a per-request level.

**Desktop (please complete the following information):**
- OS: Linux
- Installation Method: Flatpak
- App Version: 2021.3.0

**Additional context**
We really really need a proper solution to re-using authorization settings.

Contributor guide

Open the contributing guide

Research direction

Reproduce the conflict using the insomnia-plugin-default-headers plugin with a folder-level Authorization value and a different per-request Bearer token. Inspect the default-headers plugin entry point and the request authorization handling to determine where precedence is lost. Done means the explicit per-request Authorization is sent while the default remains available when no request-level value exists.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, authentication
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.