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

homebridge-fordpass

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

homebridge-fordpass - npm Package Compare versions

Comparing version 1.5.2 to 1.5.3

40

dist/fordpass-connection.js

@@ -58,3 +58,4 @@ "use strict";

this.config.access_token = nextResult.data.access_token;
return true;
this.config.refresh_token = nextResult.data.refresh_token;
return nextResult.data;
}

@@ -68,12 +69,45 @@ else {

}
return false;
return;
}
catch (error) {
this.log.error(`Auth failed with error: ${error.code || error.response.status}`);
return false;
return;
}
});
}
refreshAuth() {
return __awaiter(this, void 0, void 0, function* () {
try {
if (this.config.refresh_token) {
const result = yield axios_1.default.put('https://api.mps.ford.com/api/oauth2/v1/refresh', {
refresh_token: this.config.refresh_token,
}, {
headers: {
'Content-Type': 'application/json',
'User-Agent': userAgent,
'Application-Id': applicationId,
},
});
if (result.status === 200 && result.data.access_token) {
this.config.access_token = result.data.access_token;
this.config.refresh_token = result.data.refresh_token;
return result.data;
}
else {
this.log.error(`Auth failed with status: ${result.status}`);
}
}
else {
return yield this.auth();
}
return;
}
catch (error) {
this.log.error(`Auth failed with error: ${error.code || error.response.status}`);
return;
}
});
}
}
exports.Connection = Connection;
//# sourceMappingURL=fordpass-connection.js.map

@@ -38,2 +38,5 @@ "use strict";

return __awaiter(this, void 0, void 0, function* () {
if (!this.config.access_token) {
return;
}
if (this.lastUpdatedTime) {

@@ -79,2 +82,5 @@ const checkTime = new Date(this.lastUpdatedTime);

return __awaiter(this, void 0, void 0, function* () {
if (!this.config.access_token) {
return '';
}
let method = 'GET';

@@ -136,2 +142,5 @@ let endpoint = '';

return __awaiter(this, void 0, void 0, function* () {
if (!this.config.access_token) {
return;
}
let endpoint = '';

@@ -138,0 +147,0 @@ if (command === vehicle_1.Command.START || command === vehicle_1.Command.STOP) {

12

dist/index.js

@@ -190,8 +190,8 @@ "use strict";

const ford = new fordpass_connection_1.Connection(this.config, this.log);
const connected = yield ford.auth();
if (connected) {
const authInfo = yield ford.auth();
if (authInfo) {
setInterval(() => __awaiter(this, void 0, void 0, function* () {
self.log.debug('Reauthenticating with config credentials');
yield ford.auth();
}), 290000);
self.log.debug('Reauthenticating with refresh token');
yield ford.refreshAuth();
}), authInfo.expires_in * 1000 - 10000);
yield this.addVehicles();

@@ -202,3 +202,3 @@ yield this.updateVehicles();

yield self.updateVehicles();
}), 60000);
}), 60 * 1000);
}

@@ -205,0 +205,0 @@ });

{
"displayName": "Homebridge FordPass",
"name": "homebridge-fordpass",
"version": "1.5.2",
"version": "1.5.3",
"description": "Fordpass plugin for homebridge: https://homebridge.io/",

@@ -6,0 +6,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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