[FEATURE REQUEST] Design API collapses multiple bearer tokens into one variable reference for all debug requests
- Dominant language
- TypeScript
- Stars
- 40k
- Forks
- 2.4k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 61
Description
### Expected Behavior
When multiple bearer token authentication schemes are specified in the API design document, debug requests that are auto-inserted on the Debug tab should use different variables to reference each type of bearer token.
### Actual Behavior
Debug requests auto-inserted on the Debug tab all use the same variable name - `bearerToken`, which requires manual edits for all of them every time the design document is changed.
### Reproduction Steps
* Create a new design document with multiple bearer token schemes:
```yaml
openapi: "3.0.0"
info:
title: 'ABC'
version: '0.1.0'
components:
securitySchemes:
bearerA:
type: 'http'
scheme: 'bearer'
bearerB:
type: 'http'
scheme: 'bearer'
paths:
/abc/:
get:
summary: 'Uses bearerA'
security:
- bearerA: []
responses:
'200':
description: 'Success'
/xyz/:
get:
summary: 'Uses bearerB'
security:
- bearerB: []
responses:
'200':
description: 'Success'
```
* Click Authorize button in the preview pane of the design document - there will be authorization input box for each bearer token.
* Switch to the Debug tab and wait for both requests to appear in the list.
* Switch to the Bearer tab and click each request - they all reference `bearerToken` variable, even though their authentication schemes are different in the design document, so each must be edited manually before it can be used.
### Is there an existing issue for this?
- [X] I have searched the [issue tracker](https://www.github.com/Kong/insomnia/issues) for this problem.
### Additional Information
One workaround I found is to use folder environment to give different values to the same variable, such as `bearerToken`. Not sure if this is the intended behavior for same-name variables on the Debug tab - I cannot find any docs on this.
It's usable, but less descriptive because type of bearer token isn't immediately visible in the request and the environment need to be inspected to see the mapping of `bearerToken` to the actual token defined, for example, in the parent environment.
### Insomnia Version
2021.6.0
### What operating system are you using?
Windows
### Operating System Version
Windows 10 Pro Version 21H2 OS build 19044.1387
### Installation method
Insomnia website download
### Last Known Working Insomnia version
_No response_
Contributor guide
Research direction
Start by reproducing the issue with the supplied OpenAPI document, then trace how securitySchemes are converted into auto-inserted Debug tab requests and Bearer authorization variables. Done means requests using bearerA and bearerB reference distinct, descriptive variables without manual edits after the design changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, typescript
- Domain
- api, authentication
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100