npm.io
5.0.0 • Published 2 years ago

onedionys-jwt-authentication-middleware

Licence
ISC
Version
5.0.0
Deps
132
Size
14 kB
Vulns
0
Weekly
0

Welcome to One Dionys - JWT Authentication Middleware!

Middleware to handle JSON Web Token (JWT) token-based authentication within the application server.

Requirements

  • Web Browser - Can be used as an emulator to build applications. Example [Chrome, Firefox, Safari & Opera].
  • Internet - Because many use CDN and to make it easier to find solutions to all problems.

How To Use

Example Syntax
const express = require('express');
const jwtAuthenticationMiddleware = require('./src/jwtAuthenticationMiddleware');

const app = express();

// Apply JWT authentication middleware to all routes
app.use(jwtAuthenticationMiddleware);

// Protected routes...
Explanation
  • This middleware verifies the presence and validity of JWT tokens passed in the HTTP headers. If the token is missing or invalid, it responds with a 401 Unauthorized error. If the token is valid, it attaches the decoded token payload to the request object for further processing.
Return Value
  • The middleware returns a 401 Unauthorized error if the token is missing or invalid. Otherwise, it calls the next middleware function in the chain.

Release Date

  • v1.0.0 : 17 March 2024
  • v1.0.1 : 18 March 2024
  • v5.0.0 : 31 March 2024

Author

License

  • Copyright 2024 One Dionys
  • One Dionys - JWT Authentication Middleware is an open source project licensed under the MIT license

Suppport & Donation

Love One Dionys - JWT Authentication Middleware? Support this project by donating or sharing with others in need.

Made with One Dionys

Keywords