Learn go series: Part III - Stuck in the middle!

Tue Jan 09 2018

Alternate title: Working with JWT, CORS as middlewares using Negroni.

This is Part 3 of "Learn go" series. You can find the previous post here.

In this post, I will be walking you through an example of adding middlewares for working with JWT for sessions. As well as making an API, CORS compatible. This post picks up from the previous posts Part I and, Part II, so if you haven't read, please skim through it.

For creating a jwtToken we need a jwtSigningKey defined. This is a random alphanumeric string. This needs to be kept secret as this verifies the signed token's authenticity. We can then create a new token using jwt.