Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

keymetrics-api

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keymetrics-api - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

24

lib/Authenticate.js

@@ -26,2 +26,3 @@ 'use strict';

this.http = new Http();
this.refresh_token = opts.token || '';

@@ -49,4 +50,5 @@ this.bus.on('auth:ready', function (data) {

cb = token;
token = this.token || '';
token = this.refresh_token || '';
}
cb = cb || function(){};

@@ -69,2 +71,17 @@ var post = this.http

Authenticate.prototype.checkExpiration = function() {
var self = this;
var date = new Date(this.expire_at)
if (Date.now() - date.getTime() < 10 * 60000)
this.refresh(function(err, data) {
if (err) {
self.bus.emit('error:auth', { msg: 'Refeshing token failed, maybe invalid/revoked token ?', err: err });
return err;
}
self.bus.emit('auth:ready', data);
});
};
/**

@@ -91,2 +108,6 @@ * Starts the authentication process

self.bus.emit('auth:ready', data);
// start watcher
self.watcher = setInterval(self.checkExpiration.bind(self), 60000);
return cb(null, data);

@@ -132,4 +153,5 @@ })

});
clearInterval(self.watcher);
};
module.exports = Authenticate;

2

package.json
{
"name": "keymetrics-api",
"version": "1.2.1",
"version": "1.3.0",
"description": "Keymetrics API Wrapper",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc