New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

oauth2-refresh-token

Package Overview
Dependencies
Maintainers
7
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oauth2-refresh-token

Keeps oauth2 auth token refreshed, handles refresh token management.

latest
Source
npmnpm
Version
4.0.0
Version published
Weekly downloads
30
650%
Maintainers
7
Weekly downloads
 
Created
Source

oauth2-refresh-token

Makes managing oauth2 access and refresh tokens easy. Call refresh() to refresh the access token (and store the latest refresh token.) Call getAccessToken() to get the latest access token. It will not auto-refresh if the access token has expired... You need to do this.

Usage:

var refreshToken = require('oauth2-token-refresh')('postgres://somedbserver/somedb', credentials, 'initial refresh token');

refreshToken.refresh(); //returns a promise
refreshToken.getAccessToken().then(function(result) {
  console.log(result);
});

credentials are passed through to simple-oath2 and take the form:

// Set the configuration settings
const credentials = {
  client: {
    id: '<client-id>',
    secret: '<client-secret>'
  },
  auth: {
    tokenHost: 'https://api.oauth.com'
  }
}

Local dev

docker-compose run psql psql -h postgres -c 'create database "refresh-token-test"' -U postgres
docker-compose run node npm test

Keywords

token

FAQs

Package last updated on 12 Aug 2019

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