In this video we are going to look at using JSON Web Tokens to secure your Go REST API. We will learn how to create a JWT and use middleware to ensure that the REST API is secured.
JWTs, in my opinion, are better suited for a REST API. If you wish to secure a web application using JWTs, you can get it to work but I think Server Side Sessions are better suited. Of course, if you need to be flexible with having your server secured for a web browser, a mobile app, another server, using curl, etc, then you will probably need to use JWT Authentication.
More Information on the JWT specification:
If you are looking for Server Side Sessions, watch this video:
Here are a couple blog posts for more information:
~joepie91/blog/2016/06/13/stop-using-jwt-for-sessions/
~joepie91/blog/2016/06/19/stop-using-jwt-for-sessions-part-2-why-your-solution-doesnt-work/
And here is the video explaining JWTs vs Server Side Ses