4.0.0 • Published 5 years ago

oauth2-refresh-token v4.0.0

Weekly downloads
4
License
BSD-3-Clause
Repository
github
Last release
5 years ago

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
4.0.0

5 years ago

4.0.0-tokens.0

5 years ago

3.1.0-tokens.1

5 years ago

3.1.0-tokens.0

5 years ago

3.0.4

8 years ago

3.0.3

8 years ago

3.0.2

8 years ago

3.0.1

8 years ago

3.0.0

8 years ago

2.0.0

8 years ago

1.0.0

8 years ago