How To Build JWT’s in Go (Golang)
By Lane Wagner – @wagslane on Twitter Go is becoming very popular for backend web development, and JWT’s are one of the most popular ways to handle authentication on API requests. In this article, we are going to go over the basics of JWT’s and how to implement a secure authentication strategy in Go! What is a JWT? JSON Web Tokens are an open, industry standard RFC 7519 method for representing claims securely between two parties. https://jwt.io/ More simply put, JWT’s are encoded JSON objects that have been signed by the server, verifying authenticity. For example, when a user logs in to a website secured via JWTs, the flow should look something like this: The user sends a username and password to the server The server verifies username and password are correct The server creates a JSON object (aka claims) that looks like this: {“username”:”wagslane”} The server encodes and signs the JSON object, creating a JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6...