Socket
Book a DemoInstallSign in
Socket

refresh-tokens

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

refresh-tokens

refresh tokens library for nodejs server with mongodb

0.1.1
latest
npmnpm
Version published
Weekly downloads
7
250%
Maintainers
1
Weekly downloads
 
Created
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

refresh-tokens

FAQs

Package last updated on 13 Jul 2020

Did you know?

Socket

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.