1.1.1 • Published 4 years ago

sails-jwtauth v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

sails-jwtauth

JWT Auth logic for js.

Installation

$ npm install sails-jwtauth --save

Usage

Add a secret key in config file for the invironment you are currently working on. For exameple in the config/env/development.js file:

module.exports = {
  secret: 'private key',
};

for creating a token:

const jwtauth = require('sails-jwtauth');
let token = await jwtauth.signToken(payload);
return res.json({
  token: token,
});

for decoding a token:

const jwtauth = require('sails-jwtauth');
let decoded = await jwtauth.verifyToken(payload);
return res.json({
  decodedToken: decoded,
});

## License

This module is available under the **MIT license**.
1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago