Forum Discussion

switzer's avatar
switzer
Occasional Contributor
8 years ago

Is there a seamless way to use JWT (JSON web tokens) to authenticate a user in SwaggerHub?

Currently, the workflow to authenticate a user is as follows:

 

1.  Manually edit example JSON in the /login endpoint.

2.  Copy the response header string and add as a header variable to the endpoints that need authentication.

 

 

It would be optimal to build an authentication type of 'JWT' - where the user could log in by just typing their username/password into text fields and clicking 'authenticate'.

 

This JWT modification has been done by the Swagger community and is a relatively straightforward modification to swagger-ui.

 

Is this anywhere on the SwaggerHub roadmap?

 

Thanks

 

1 Reply

  • Hi, JWT is not supported by the OpenAPI specification right now but it is in the roadmap to add.  Because SwaggerHub is producing OpenAPI-compliant specifications, we have not added special support for JWT.

     

    Right now you do need to paste the token into the authentication like you described.  I'll see if there's another way we can do this.