1.0.4 • Published 5 months ago

simple-jwt-authentication v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

Authentication Package

This Node.js package provides a simple and straightforward solution for user authentication using JSON Web Tokens (JWT). It allows you to generate JWTs based on user email and password, making it suitable for securing web applications.

Installation

To install the package, use npm: npm install simple-jwt-authentication

Usage

Import the Package const authenticationPackage = require('simple-jwt-authentication');

Generate Token

Use the generateToken function to create a JWT: const email = 'user@example.com'; const password = 'userpassword'; const secretKey = 'your-secret-key';

const token = authenticationPackage.generateToken(email, password, secretKey); console.log('Generated Token:', token);

Authenticate User

The authenticateUser function is designed for user authentication:

try {
  const token = authenticationPackage.authenticateUser(email, password, secretKey);
  console.log('Authentication Successful. Token:', token);
} catch (error) {
  console.error('Authentication Failed:', error.message);
}

Note: Ensure that you replace 'your-secret-key' with your actual secret key.

Package Details :-

Version: 1.0.0 Author: Gourav Pundir License: ISC Dependencies jsonwebtoken (^9.0.0)

Contributing

Feel free to contribute by opening an issue or submitting a pull request.

1.0.4

5 months ago

1.0.3

5 months ago