https://github.com/wpcodevo/go-postgres-jwt-auth-api
In this article, you will learn how to implement authentication and role-based authorization in Golang using JSON Web Tokens (JWT).
https://github.com/wpcodevo/go-postgres-jwt-auth-api
authentication authorization fiber-framework go golang gorm jwt postgresql
Last synced: 2 months ago
JSON representation
In this article, you will learn how to implement authentication and role-based authorization in Golang using JSON Web Tokens (JWT).
- Host: GitHub
- URL: https://github.com/wpcodevo/go-postgres-jwt-auth-api
- Owner: wpcodevo
- Created: 2024-11-05T14:52:07.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-11-07T23:05:29.000Z (about 1 year ago)
- Last Synced: 2025-01-26T03:41:16.639Z (11 months ago)
- Topics: authentication, authorization, fiber-framework, go, golang, gorm, jwt, postgresql
- Language: Go
- Homepage: https://codevoweb.com/json-web-token-authentication-and-authorization-in-golang/
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JSON Web Token Authentication and Authorization in Golang
In this article, you will learn how to implement authentication and role-based authorization in Golang using JSON Web Tokens (JWT).

## Topics Covered
- Run and Test the JWT Authentication and Authorization Flow in Golang
- Bootstrap the Golang Project
- Set up PostgreSQL and pgAdmin with Docker
- Load Environment Variables into the Application
- Connect the Application to the PostgreSQL Server
- Create the User Model and Request Schemas
- Implement Authentication Logic
- Sign Up User Route Handler
- Sign In User Route Handler
- Logout User Route Handler
- The Complete Auth Route Handlers
- Create the Authentication Middleware
- Implement Role-Based Authorization Middleware
- Create User-Related Route Handlers
- Get Profile Information Route Handler
- Get Users Route Handler
- Set up Routes for the Handlers
- Register the Router and Configure CORS
- Testing the JWT Authentication and Authorization Features of the API
- Sign Up
- Sign In
- Get Your Profile Information
- Admin Retrieve Users
- Conclusion
Read the entire article here: [https://codevoweb.com/json-web-token-authentication-and-authorization-in-golang/](https://codevoweb.com/json-web-token-authentication-and-authorization-in-golang/)