Posts

Showing posts from December, 2018

Adding Swagger UI with JWT Authentication in asp.net web api

Image
Introduction Swagger allows you to describe the structure of your APIs so that machines can read them. The ability of APIs to describe their own structure is the root of all awesomeness in Swagger. Why is it so great? Well, by reading your API’s structure, we can automatically build beautiful and interactive API documentation. We can also automatically generate client libraries for your API in many languages and explore other possibilities like automated testing.  Swagger does not only allows you to do API documentation but you can also authorize each endpoint in the swagger doc. In this tutorial, I use JWT to authenticate and pass the token to the "api_key" field which gives you access to protected resources. If you're not familiar with swagger, you should try checking out their website  http://swagger.io/ Adding Swagger UI with JWT Authentication in asp.net web API To authenticate your swagger using jwt tokens, you have to start by installing the swashbuckl