refresh-tokens
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

Use

No ES6

const refreshTokens = require('refresh-tokens/dist/index');
const app = express(); // creates a express app
const refreshTokens = new refreshTokens.default({
  expiresIn: 60 * 10, // 10 minutes in seconds
  jwtSecret: 'JWT_SECRET'
});
// connect to mongoDB (If your project is already use mongoose and it connect with the mongoDB  you can call directly  to refreshTokens.init(app);)
refreshTokens.connectToDB(
  {
    uri: 'mongodb://<user>:<password>@<host>:<port>/<DB_NAME>'
  },
  function(error: any) {
    if (error) {
      console.log('error to connecto mongDB', error);
    } else {
      // enable the refresh Tokens API
      refreshTokens.init(app);
    }
  }
);

ES6 with typescript

import RefreshTokens from 'refresh-tokens';
const app: Application = express(); // creates a express app
const refreshTokens = new RefreshTokens({
  expiresIn: 60 * 10, // 10 minutes in seconds
  jwtSecret: 'JWT_SECRET'
});
// connect to mongoDB (If your project is already use mongoose and it connect with the mongoDB  you can call directly  to refreshTokens.init(app);)
refreshTokens.connectToDB(
  {
    uri: 'mongodb://<user>:<password>@<host>:<port>/<DB_NAME>'
  },
  function(error: any) {
    if (error) {
      console.log('error to connecto mongDB', error);
    } else {
      // enable the refresh Tokens API
      refreshTokens.init(app);
    }
  }
);

Refesh Tokens API

just go to http://<your-host:port>/refresh-tokens-api-docs

Readme

Keywords

Package Sidebar

Install

npm i refresh-tokens

Weekly Downloads

2

Version

0.1.1

License

MIT

Unpacked Size

26 kB

Total Files

23

Last publish

Collaborators

  • darwinmorocho