Coder Social home page Coder Social logo

wpcodevo / golang-fiber-jwt-rs256 Goto Github PK

View Code? Open in Web Editor NEW
18.0 1.0 4.0 36 KB

In this comprehensive guide, you'll learn how to properly refresh JSON Web Tokens (JWTs) using the RS256 algorithm and Redis. The integration of Redis will give us the ability to effortlessly revoke or invalidate the JWTs when necessary.

Home Page: https://codevoweb.com/how-to-properly-use-jwt-for-authentication-in-golang/

Shell 15.67% Go 82.71% Makefile 1.61%
asymmetric-cryptography bcrypt fiber fiber-framework go golang jwt pgadmin4 postgresql private-key

golang-fiber-jwt-rs256's Introduction

How to Properly Refresh JWTs for Authentication in Golang

In this comprehensive guide, you'll learn how to properly refresh JSON Web Tokens (JWTs) using the RS256 algorithm and Redis. The integration of Redis will give us the ability to effortlessly revoke or invalidate the JWTs when necessary.

How to Properly Refresh JWTs for Authentication in Golang

Topics Covered

  • Run the Golang + Fiber JWT Project Locally
  • Flaws of using only JWTs for Authentication
  • Solutions to Address the Flaws of JWTs
  • Bootstrap the Golang Project
  • Setup Postgres, Redis, and pgAdmin with Docker
  • Create the Database Model
  • Connect to the Redis and Postgres Containers
    • Load the Environment Variables
    • Connect to the Redis Server
    • Connect to the Postgres Server
  • Generate the Private and Public Keys
  • Sign and Verify JWTs with the Asymmetric Keys
    • Sign the JWT with the Private Key
    • Verify the JWT with the Public Key
  • Implement the JWT Authentication
    • Create the Account Registration Route Handler
    • Create the Account Login Route Handler
    • Create the Refresh Token Route Handler
    • Create the Logout Route Handler
  • Create the JWT Middleware Guard
  • Retrieve the Authentication User
  • Register the Routes and Add CORS to the Server

Read the entire article here: https://codevoweb.com/how-to-properly-use-jwt-for-authentication-in-golang/

golang-fiber-jwt-rs256's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

golang-fiber-jwt-rs256's Issues

redis didnt connect

panic: NOAUTH HELLO must be called with the client already authenticated, otherwise the HELLO AUTH option can be used to authenticate the client and select the RESP protocol version at the same time

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.