golang-mongodb

command module
v0.0.0-...-f1d9a45 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 14 Imported by: 0

README

Golang & MongoDB: JWT Authentication and Authorization

In this article, you'll learn how to implement RS256 JWT (JSON Web Token) Authentication and Authorization with Golang, Gin Gonic, MongoDB-Go-driver, and Docker-compose.

Topics Covered

  • Golang & MongoDB JWT Authentication Overview
  • JWT Authentication Example with Golang and MongoDB
  • How to Generate Public and Private Keys
  • Update Environment Variables with Viper
  • Creating the User models with structs
  • Creating an Auth and User Interfaces
    • Authentication Interface
    • User Interface
  • Create utility functions to hash and verify password
  • Create services that interact with the database
    • Auth interface implementation
    • User interface implementation
  • Create a utility function to sign and verify JWT tokens
    • Create Json Web Token
    • Verify JSON Web Token
  • Create the authentication controllers
    • Signup user controller
    • Login user controller
    • Refresh access token controller
    • Logout user controller
  • Authentication Middleware Guard
  • Create the user controllers
  • Create API Routes with Gin
    • Auth Routes
    • User Routes
  • Add the Routes to the Gin Middleware Pipeline

Read the entire article here: https://codevoweb.com/golang-mongodb-jwt-authentication-authorization

Articles in this series:

1. API with Golang + MongoDB + Redis + Gin Gonic: Project Setup

API with Golang + MongoDB + Redis + Gin Gonic: Project Setup

2. Golang & MongoDB: JWT Authentication and Authorization

Golang & MongoDB: JWT Authentication and Authorization

3. API with Golang + MongoDB: Send HTML Emails with Gomail

API with Golang + MongoDB: Send HTML Emails with Gomail

4. API with Golang, Gin Gonic & MongoDB: Forget/Reset Password

API with Golang, Gin Gonic & MongoDB: Forget/Reset Password

5. Build Golang gRPC Server and Client: SignUp User & Verify Email

Build Golang gRPC Server and Client: SignUp User & Verify Email

6. Build Golang gRPC Server and Client: Access & Refresh Tokens

Build Golang gRPC Server and Client: Access & Refresh Tokens

7. Build CRUD RESTful API Server with Golang, Gin, and MongoDB

Build CRUD RESTful API Server with Golang, Gin, and MongoDB

8. Build CRUD gRPC Server API & Client with Golang and MongoDB

Build CRUD gRPC Server API & Client with Golang and MongoDB

golang-mongodb

golang-mongodb

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL