[BUG] Can't send Authorization header through Swagger
See original GitHub issueDescribe the bug I can’t send Authorization header using Swagger. If i using ANY name, even authorization_, i can send this header, but not clear Authorization header.
Screenshots “None” or “…” in Header() don’t cause any effect except 422 validation error. My code:
@auth_routes.get(
'/userInfo',
response_model=AuthResult,
summary="Getting current user's info from session",
responses={**ADDITIONAL_RESPONSES}
)
async def get_current_user_info(authorization_: str = Header(...)) -> AuthResult:
user_info: AuthResult = await auth_service.get_user_info(authorization)
return user_info
Valid header authorization
(or Authorization, name of variable don’t cause any effect on Swagger’s side):
Wrong header authorization_
or any x-some-header
and etc. :
As we can see, Swagger just sent -H "authorization-:*token*
Environment: Windows 10 on testing machine Ubuntu 16.04 LTS on VPS
Python 3.7 fastapi==0.41.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Unable To Send Bearer Token in Authorization Header In ...
I am able to add the securitySchemes + child options and I get the green Authorize button in my swagger docs, but when...
Read more >How to Use Swagger Inspector
If you don't have any authentication, headers, or query parameters to add, press Send. The Send button becomes enabled once you've put a...
Read more >Authorization header not sent by swagger-ui - Google Groups
Firebug does not show the Authorization header getting sent and the API is responding with a 401. You can take a look yourself...
Read more >Auth token is not passing through header - the Tyk community
Our Nodejs REST API is using the JWT token for authentication. When we are trying to send the request from the Tyk where...
Read more >Add an authorization header to your swagger-ui with ...
Once you've done that, when you “Try it out” using the Swagger-UI, the authorization header with your bearer token should be sent to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s part of the OpenAPI spec.
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#fixed-fields-10
You cannot declare headers of
Accept
,Content-Type
, orAuthorization
.For
Authorization
you can use FastAPI’sHTTPBearer
.That sets the required
Authorization
header in the right place in OpenAPI and references it from your path operation using it.Good morning, my name is Wesley.
I’m facing the same problem regarding the “Authorization” header using the Fast-Api-Jwt lib, if anyone has the solution and can share I will be extremely grateful
Att.