swagger-api / swagger-api/swagger-ui
net::ERR_CONNECTION_CLOSED when Bearer token over 5260 characters.
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Hi Team,
I'm using version 3.25.
I get a strange issue for one of the users (unfortunately tester).
When the user tries to execute API gets the result:
CODE: undocumented; Details: TypeError: Failed to fetch
On console, we get: net::ERR_CONNECTION_CLOSED
We are using Bearer Token authorization.
The only difference between working user cases and fail is the token.
A user on with it fails have many roles stored in the token and the length of the header token is over 5260 chars.
Way to reproduce:
- Create API with Header Bearer Token authorization.
- Call API by setting token over 5260 chars length.
There is no issue when the user calls endpoint through curl command or postman.
Example API:
{
"openapi": "3.0.1",
"info": {
"title": "Warehouse API",
"version": "v1"
},
"paths": {
"/api/test": {
"get": {
"tags": [
"test"
],
"parameters": [ ],
"responses": {
"200": {
"description": "Success"
}
}
},
},
},
"components": {
"schemas": {},
"securitySchemes": {
"TST-Bearer": {
"type": "apiKey",
"description": "JWT Authorization header using the Bearer scheme. Example: \"TST-Authorization: Bearer {token}\"",
"name": "TST-Authorization",
"in": "header"
}
}
},
"security": [
{
"TST-Bearer": [
"readAccess",
"writeAccess"
]
}
]
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the documented Swagger UI API call in a browser with a Bearer token longer than 5260 characters, then compare it with curl or Postman and inspect the browser console for the connection closure. Done means the Swagger UI request succeeds with the long token or the supported limitation is documented with a clear failure message.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100