Socket
Socket
Sign inDemoInstall

refresh-tokens

Package Overview
Dependencies
265
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    refresh-tokens

refresh tokens library for nodejs server with mongodb


Version published
Maintainers
1
Install size
23.7 MB
Created

Readme

Source

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

Keywords

FAQs

Last updated on 13 Jul 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc