In this article, you'll learn how to implement JSON Web Token authentication with access and refresh tokens using the Web Cryptography API provided in Deno. The Web Crypto API is a low-level interface for performing cryptographic operations such as hashing, signature generation and verification, encryption, and decryption.
- Run the Deno JWT Project Locally
- Setup Deno
- Generate the Private and Public Keys
- Convert the Keys to CryptoKeys
- Sign and Verify the JSON Web Tokens
- Sign the JWT with the RS256 Algorithm
- Verify the JWT with Asymmetric Keys
- Create Authentication Route Handlers
- Register User Controller
- Login User Controller
- Refresh Token Controller
- Logout User Controller
- Create a GetMe Router Handler
- Create an Authentication Guard
- Create the API Routes
- Add the API Router to the App
- Testing the JWT Authentication Flow in Postman
- Register User
- Login User
- Refresh Access Token
- Get Authentication User
- Logout User
Read the entire article here: https://codevoweb.com/deno-jwt-authentication-with-private-and-public-keys/