You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
security: add support for Authorization header with Bearer authentication scheme #583
In Swagger 2.0 there is no way to tell that the apiKey can be given in the Authorization header using a given (non-Basic) authentication scheme. For example the Bearer scheme defined in RFC 6750 that is used for OAuth2 but could be used also for non-OAuth2 authentication.
Proposal: add the API Key location authorization in the Security Scheme Object:
Reacted by Clinton Blackburn, Pau RE, Tommaso Patrizi, Matthew Hartstonge, Yuri Skurikhin, Paulo Oliveira, Xiaoyu Guo, alecha, Mike Mansell, René Jochum and 52 more
Reacted by Mniak, gerdos82, Tyler Vorpahl and Vinícius Feitosa da Silva
Reacted by Miguel Luís, Rebecca Bauer, Matthew Hartstonge, Yuri Skurikhin, Dmitri Toubelis, Thomas Kolar, Kazuaki SHIBUE, Gabo Esquivel, Victor Gazotti, Dario Nascimento and 124 more
Reacted by Dmitri Toubelis, Yosbel Esperón González, Ivan Zmerzlyi, Gaspard d'Hautefeuille, will, Vincent BARAT, Dragan Mijatovic, Marco Descher, Hamzah Waqas, Jake Swenson and 29 more
Reacted by Dmitri Toubelis, Ivan Zmerzlyi, Teemu Niiranen, Darrel O'Pry, Dragan Mijatovic, Jake Swenson, Vladimir Dmitrovskiy, Danny Dombrowski, nikitaraturi12, Pierre and 15 more
Does it make sense to put in a template?
Pro: covers a wide range of possibilities
Con: We lose the descriptive value, ie: We don't know what type of authentication (JWT, oAuth, etc) this is, we just know how the tools should implement it.
type: bearer # in header, implied# name Authorization, implied# Con: a little terse
Reacted by Yaroslav, Guil. Sperb Machado, Nazar Dub, Mniak, Nathan Broadbent, Vlad Tsepelev, m-matveev, Filippo Conti, Daisuke Kondo, Alex Pan and 12 more
Reacted by Andrew Johnson, Minor Arrieta Rojas and Ezequiel Cavallo
As a temporary solution that seems to work, at least to me, is to add "Bearer " prefix manually in the auth dialog of Swagger UI.
Reacted by Tuatini Godard, Alexander Sidorov, Dragan Mijatovic, Alexandr Marchenko, Mi Zhou, Vamsi Krishna B, mofelee, Karol, Piper, Frederik Göbel and 39 more
Reacted by Atif Riaz, Jorge Villada, Evan Villemez, НазарКо, Andrii Yurchuk, Alex, Wojciech Frącz, Nikos Monahogios, Michael Marcotrigiano, Azim Pulat and 4 more
Reacted by quocson1, Leo Lopez, Seth-Jetro JOSEPH, Deepak Sethy, Vladimir Osintsev and bravedragon331
Reacted by AlexByte, Seth-Jetro JOSEPH, Vladimir Osintsev and bravedragon331
@ratanakpek please note that this repository is about the OpenAPI specification, not any specific implementation. This issue specifically is about the next version of OpenAPI, for which there are no implementations yet.
It looks like you have a problem with some tooling (not sure which one) – please open an issue there (first have a look whether there already is an issue for this.) You'll need to provide more information, though.
Activity
fehguy commentedon Feb 29, 2016
are you saying that the
apiKeyscheme described here:https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#security-scheme-object
is insufficient?
dolmen commentedon Feb 29, 2016
Yes, of course, the security scheme of Swagger 2.0 is insufficient.
The
apiKeyscheme withinset toheaderis designed for a custom header where the api key will be the whole value of the header. For example:will send this:
I need this:
alecha commentedon Feb 29, 2016
+1, I'm using JWT and I'd need the same thing
cabbonizio commentedon Feb 29, 2016
+1 in addition to using JWT
dolmen commentedon Mar 1, 2016
About authentication with JWT
fehguy commentedon Mar 1, 2016
Parent issue #585
ChrisPearce commentedon Mar 3, 2016
+1
jvivs commentedon Mar 25, 2016
+1
cbornet commentedon Apr 12, 2016
+1 for JWT support. But I would prefer something like "type": "jwt" as this gives more info about the type of authentication.
K1ll3rF0x commentedon Jun 27, 2016
Here is a related approach to add JWT support into Swagger UI project swagger-api/swagger-ui#2234.
dolmen commentedon Jun 27, 2016
@cbornet This issue is not just about JWT.
ponelat commentedon Jun 27, 2016
Does it make sense to put in a template?
Pro: covers a wide range of possibilities
Con: We lose the descriptive value, ie: We don't know what type of authentication (JWT, oAuth, etc) this is, we just know how the tools should implement it.
Template eg:
Conversely, we could just have...
dolmen commentedon Jun 27, 2016
@ponelat wrote:
Swagger implementations have already too many security holes that allow code injection. No need to add one more vector with templated content.
16 remaining items
cschachinger commentedon Nov 30, 2016
+1 for Bearer support
vincentbarat commentedon Dec 13, 2016
+1 for Bearer
basharov commentedon Dec 16, 2016
As a temporary solution that seems to work, at least to me, is to add "Bearer " prefix manually in the auth dialog of Swagger UI.
jtn-d commentedon Dec 30, 2016
+1 for Bearer
teemuniiranen commentedon Jan 12, 2017
+1 for JWT Bearer token
CollinGraves commentedon Jan 20, 2017
Need. JWT. Please.
fehguy commentedon Jan 20, 2017
@CollinGraves it will be supported in 3.0 through #818
dsx1986 commentedon Feb 17, 2017
+1 for JWT Bearer
fehguy commentedon Feb 17, 2017
Already added, no need to +1 here :)
ratanakpek commentedon Mar 23, 2017
I got error, I try to install the swagger but it error about $urltoDoc,.... in views/vendor/l5-swagger.index.blade.php. Please kindly help! Thanks!
Message error: below is the error msg.
https://2.bp.blogspot.com/-wlExmpcjcjw/WNKq_J7YeZI/AAAAAAAAC5g/ftwwzC1Rr0s3Jyz6AnehJCqvXC1zoWJPQCLcB/s1600/15.PNG
ePaul commentedon Mar 23, 2017
@ratanakpek please note that this repository is about the OpenAPI specification, not any specific implementation. This issue specifically is about the next version of OpenAPI, for which there are no implementations yet.
It looks like you have a problem with some tooling (not sure which one) – please open an issue there (first have a look whether there already is an issue for this.) You'll need to provide more information, though.
paulocdf commentedon Jan 22, 2018
Is it possible now to have the apikey using the Bearer authentication?
Authorization: Bearer <apiKey>MikeRalphson commentedon Jan 22, 2018
Yes, in v3.0 - see this example. You can omit the
bearerFormathint if you want.Note that
apiKeyandhttpare differenttypes ofsecurityScheme.twitnic commentedon Oct 17, 2018
@MikeRalphson with:
I get: "User Warning: @OA\SecurityScheme() is missing key-field: "securityScheme""
MikeRalphson commentedon Oct 17, 2018
@twitnic that sounds like a problem with a specific tool, not with the specification itself.