cancel
Showing results for 
Search instead for 
Did you mean: 

Testing with JWT and SwaggerHub

Occasional Contributor

Testing with JWT and SwaggerHub

Maybe I'm missing something here, but I would like to document our existing API using SwaggerHub (with the ultimate plans to define and replace our existing hand-built API).  Our API uses OAuth2 with JWT authorization tokens, so that complicates the testing.

I have built a first endpoint definition in SwaggerHub and now want to execute against it with a set of parameters so that I can record the response as part of the documentation.  But since our API requires a Bearer Authorization header, I need a way insert that token.

I don't think that Swagger is capable of retrieving the JWT token itself, so assume that I will need to grab a current JWT token and put it somewhere in Swaggerhub.  Is there a place for me to put the token so that I can execute a request on our API?

1 REPLY 1
Highlighted
New Contributor

Re: Testing with JWT and SwaggerHub

Hi,

 

Is it possible to generate a JWT with the swagger?

 

securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT # optional, for documentation purposes only

New Here?
Join us and watch the welcome video:
Watch the new Interview