Bearer / JWT security definitions is not working
See original GitHub issueHi, we just testing new version of swagger-ui, the new functions is badly documented so we reverse engineered needed configuration values from source code, but maybe our assumptions were bad.
Q | A |
---|---|
Bug or feature request? | Bug |
Which Swagger/OpenAPI version? | |
Which Swagger-UI version? | latest from master |
How did you install Swagger-UI? | grom git |
Which browser & version? | Chrome latest |
Which operating system? | Mac OS X |
Demonstration API definition
securityDefinitions:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
Expected Behavior
Bearer auth should be visible in Authorize section
Current Behavior
Unknown security definition type http in this window
Possible Solution
Add some section to https://github.com/swagger-api/swagger-ui/blob/master/src/core/components/auth/auth-item.jsx to ensure
Context
We wanted to use swagger-ui for swagger api using JWT.
Thanks a lot for your help.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Jwt authentication implement in swagger api? - Stack Overflow
According to the Swagger documentation about Bearer authentication, you should use the following configuration: securityDefinitions: ...
Read more >Troubleshooting issues with HTTP API JWT authorizers
The following provides troubleshooting advice for errors and issues that you might encounter when using JSON Web Token (JWT) authorizers with HTTP APIs....
Read more >Bearer Authentication - Swagger
In OpenAPI 3.0, Bearer authentication is a security scheme with type: http and scheme: bearer . You first need to define the security...
Read more >JSON Web Token Introduction - jwt.io
Since tokens are credentials, great care must be taken to prevent security issues. In general, you should not keep tokens longer than required....
Read more >OAuth2 with Password (and hashing), Bearer with JWT tokens
After a week, the token will be expired and the user will not be authorized and will have to sign in again 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 Free
Top 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
@jakubjosef, that should work if you change
bearerAuth:[]
to- bearerAuth: []
, since security requirements undersecurity
need to be arrays.Here’s a minimal example of a definition that will use bearer auth globally:
Can anyone tell me why my Available Authorizations box is empty in my swagger ui with this code.