Create Golang (Go programming language) RESTful API authentication with a JSON Web Tokens (JWT) in less than 2 hours.
Build Golang (Go programming language) REST API authentication with JWTs is a straightforward introductory guide on creating secure Golang APIs with JSON Web Tokens (JWTs).
- learn the theory behind JSON WEB TOKENs (JWTs) and how they are constructed and used,
- build a Golang (Go programming language) signup handler function that takes the user’s credentials such as email and password and saves them on a PostgreSQL database table,
- implement a Golang (Go programming language) utility that generates password hashes with the ‘bcrypt’ package to avoid storing plain text passwords on the database
- build a Golang (Go programming language) login handler function that takes user credentials and verifies the user based on their supplied credentials
- implement a Token generator utility that takes the user’s credentials, and together with developer specified secret and claims, generates a JSON Web Token (JWT),
- create a Golang (Go programming language) middleware function that validates a JWT token upon request to restricted routes
Also, Throughout the process you will learn several Golang (Go programming language) and REST API authentication concepts.
Aside from Golang (Go programming language), some of the major technologies you will use are:
PostgreSQL database to create a database instance and a users table where your records will be stored in,
‘jwt-go’ package for generating the JSON Web Token and its validation,
‘gorilla/mux’ package for creating the router that your endpoints and handler functions will be registered on,
‘pq’ package for parsing your database instance’s URL,
‘database/sql’ package for establishing and maintaining connection with your database instance,
‘bcrypt’ package for generating and comparing your password hashes,
Postman application for testing your APIs with several HTTP requests
Lore delivers value at the intersection of learning, interests and skills.
Access learning options recommended by industry experts, professionals and thought leaders.
Quickly search, select and add learning options to your learning list.
Tell us more about yourself to access the latest learning options, curated just for you.