O'Reilly logo

Go Web Development Cookbook by Arpit Aggarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a JSON web token

To secure your REST API or a service endpoint, you have to write a handler in Go that generates a JSON web token, or JWT.

In this recipe, we will be using https://github.com/dgrijalva/jwt-go to generate JWT , although you can implement any library from a number of third-party libraries available in Go, such as https://github.com/square/go-jose and https://github.com/tarent/loginsrv.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required