Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/noblesamurai/oauth2-refresh-token
Makes managing oauth2 access and refresh tokens easy.
https://github.com/noblesamurai/oauth2-refresh-token
Last synced: about 1 month ago
JSON representation
Makes managing oauth2 access and refresh tokens easy.
- Host: GitHub
- URL: https://github.com/noblesamurai/oauth2-refresh-token
- Owner: noblesamurai
- Created: 2016-09-22T01:37:40.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-11-02T14:25:43.000Z (about 5 years ago)
- Last Synced: 2024-12-05T18:18:01.178Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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:
```javascript
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`](https://github.com/lelylan/simple-oauth2) and take the form:```javascript
// Set the configuration settings
const credentials = {
client: {
id: '',
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
```