Golang: Intro to REST API JWT auth with Go programming lang
4.4 (251 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
1,822 students enrolled

Golang: Intro to REST API JWT auth with Go programming lang

Golang: Intro to JWT Auth with Golang (Go programming language)
4.4 (251 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
1,822 students enrolled
Created by Mike M
Last updated 2/2020
English
English [Auto]
Current price: $12.99 Original price: $19.99 Discount: 35% off
2 days left at this price!
30-Day Money-Back Guarantee
This course includes
  • 2.5 hours on-demand video
  • 4 articles
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • 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
Course content
Expand all 26 lectures 02:27:43
+ Introduction
19 lectures 01:45:07
Postman
00:53
Golang installation instructions
02:41
Join the student Group
00:14
Create the main function
06:10
Start server
06:20
Create Database Instance and Users table
06:23
Connect to database
04:52
Implement signup handler - part 1
13:56
Implement signup handler - part 2
08:57
Implement the GenerateToken function
06:51
Implement Login Handler function - part 1
07:23
Implement Login Handler function - part 2
06:35
Implement TokenVerifyMiddleware
15:17
Source Code
00:02
+ Refactor
6 lectures 42:28
Create new packages and move environment variables
09:30
Refactor models
10:11
Refactor utils
02:00
Refactor Controllers
13:35
Refactor Repository
07:07
Refactored source code
00:05
Requirements
  • Familiar with the basics of Golang and RESTful APIs
  • Any text editor (preferably visual studio code with golang plugins such as go-to definition)
Description

Build Golang (Go programming language) REST API authentication with JWTs is a simple introductory guide to 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


Who this course is for:
  • Anyone interested in creating JWT authenticated RESTful APIs with Golang