homebridge-fordpass
Advanced tools
Comparing version 1.6.0-test.0 to 1.6.0-test.1
@@ -18,3 +18,6 @@ "use strict"; | ||
const axios_1 = __importDefault(require("axios")); | ||
const authUrl = 'https://fcis.ice.ibmcloud.com/'; | ||
const authUrl = 'https://sso.ci.lincoln.com/'; | ||
const applicationId = '71A3AD0A-CF46-4CCF-B473-FC7FE5BC4592'; | ||
const clientId = '9fb503e0-715b-47e8-adfd-ad4b7770f73b'; | ||
const userAgent = 'FordPass/5 CFNetwork/1325.0.1 Darwin/21.1.0'; | ||
class Connection { | ||
@@ -33,6 +36,6 @@ constructor(config, log) { | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
'User-Agent': 'fordpass-na/353 CFNetwork/1121.2.2 Darwin/19.3.0', | ||
'User-Agent': userAgent, | ||
}, | ||
data: querystring_1.default.stringify({ | ||
client_id: '9fb503e0-715b-47e8-adfd-ad4b7770f73b', | ||
client_id: clientId, | ||
grant_type: 'password', | ||
@@ -45,5 +48,19 @@ username: this.config.username, | ||
const result = yield (0, axios_1.default)(options); | ||
if (result.status === 200) { | ||
this.config.access_token = result.data.access_token; | ||
return true; | ||
if (result.status === 200 && result.data.access_token) { | ||
const nextResult = yield axios_1.default.put('https://api.mps.ford.com/api/oauth2/v1/token', { | ||
code: result.data.access_token, | ||
}, { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'User-Agent': userAgent, | ||
'Application-Id': applicationId, | ||
}, | ||
}); | ||
if (nextResult.status === 200 && nextResult.data.access_token) { | ||
this.config.access_token = nextResult.data.access_token; | ||
return true; | ||
} | ||
else { | ||
this.log.error(`Auth failed with status: ${nextResult.status}`); | ||
} | ||
} | ||
@@ -50,0 +67,0 @@ else { |
@@ -20,3 +20,3 @@ "use strict"; | ||
'Content-Type': 'application/json', | ||
'User-Agent': 'fordpass-na/353 CFNetwork/1121.2.2 Darwin/19.3.0', | ||
'User-Agent': 'FordPass/5 CFNetwork/1325.0.1 Darwin/21.1.0', | ||
}; | ||
@@ -23,0 +23,0 @@ const fordAPIUrl = 'https://usapi.cv.ford.com/'; |
{ | ||
"displayName": "Homebridge FordPass", | ||
"name": "homebridge-fordpass", | ||
"version": "1.6.0-test.0", | ||
"version": "1.6.0-test.1", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
89009
631