4.19 out of 5
4.19
65 reviews on Udemy

Golang: Build REST API JWT authentication with Golang (Go)

Create Golang (Go programming language) RESTful API authentication with a JSON Web Tokens (JWT) in less than 2 hours.
Instructor:
Mike M
478 students enrolled
English [Auto-generated]
Build a user registration and login backend with Golang
Understand JSON Web Tokens (Header, Payload, Signature)
Create RESTful APIs (user signup, login and a protected endpoint)
Authenticate users with email, password and a JWT
Secure RESTful endpoints with JWTs
Examine the internals of a JWT
Sign and validate a JWT
Create a Postgres database instance and a users table and insert records into the table
Examine the definitions of different Golang package methods

Build Golang (Go programming language) REST API authentication with JWTs is a straightforward guide on creating secure Golang APIs with JSON Web Tokens (JWTs).

You will:

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-gopackage for generating the JSON Web Token and its validation,

  • gorilla/muxpackage for creating the router that your endpoints and handler functions will be registered on,

  • pqpackage for parsing your database instance’s URL,

  • database/sqlpackage 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

Introduction

1
Intro
2
Package Installations
3
Postman
4
Golang installation instructions
5
Some theory on JWTs
6
Create the main function
7
Start server
8
Test handler functions
9
Create the Models
10
Create Database Instance and Users table
11
Connect to database
12
Implement signup handler - part 1
13
Implement signup handler - part 2
14
Implement the GenerateToken function
15
Implement Login Handler function - part 1
16
Implement Login Handler function - part 2
17
Implement TokenVerifyMiddleware
18
Source Code

Refactor

1
Create new packages and move environment variables
2
Refactor models
3
Refactor utils
4
Refactor Controllers
5
Refactor Repository
6
Refactored source code

Bonus

1
Coupon codes


You can view and review the lecture materials indefinitely, like an on-demand channel.
Definitely! If you have an internet connection, courses on Udemy are available on any device at any time. If you don't have an internet connection, some instructors also let their students download course lectures. That's up to the instructor though, so make sure you get on their good side!
4.2
4.2 out of 5
65 Ratings

Detailed Rating

Stars 5
25
Stars 4
27
Stars 3
11
Stars 2
1
Stars 1
1
93b51df320a91f90a22be3e1333e7d62
30-Day Money-Back Guarantee

Includes

2 hours on-demand video
3 articles
Full lifetime access
Access on mobile and TV
Certificate of Completion