Skip to content

Commit

Permalink
Fix for issue #83 (#85)
Browse files Browse the repository at this point in the history
Fix for #83 

* Updated dependencies

* Updated headers and url for API requests
  • Loading branch information
MiGoller authored Dec 21, 2023
1 parent 888e080 commit 9446197
Show file tree
Hide file tree
Showing 4 changed files with 733 additions and 959 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ Feel free to modify the default timespan of 60 seconds for the polling interval.
Placeholder for the next version (at the beginning of the line):
### **WORK IN PROGRESS**
-->
### **WORK IN PROGRESS**
- (MiGoller) Fix for issue [#83 Verbindungsproblem 20.12.23 Check your credentials!](https://github.com/MiGoller/ioBroker.life360/issues/83) .
### 0.2.21 (2023-08-01)
- (MiGoller) Fix for issue [#76: Die Verbindung wurde hergestellt, die Authentifizierung konnte jedoch nicht durchgeführt werden. Überprüfen Sie Ihre Anmeldedaten!](https://github.com/MiGoller/ioBroker.life360/issues/76)
Expand Down
32 changes: 22 additions & 10 deletions lib/life360CloudConnector.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ const myLogger = new iobHelpers.IobLogger(adapter);
/**
* Hard-coded "CLIENT_SECRET": Has to be identified and verified after Life360 publishes a new version of the mobile app!
*/
const LIFE360_CLIENT_SECRET = "YnJ1czR0ZXZhcHV0UmVadWNydUJSVXdVYnJFTUVDN1VYZTJlUEhhYjpSdUt1cHJBQ3JhbWVzV1UydVRyZVF1bXVtYTdhemFtQQ==";
const DEFAULT_CLIENT_VERSION = "22.6.0.532";
const DEFAULT_USER_AGENT = "SafetyMapKoko";
const LIFE360_CLIENT_SECRET = "Y2F0aGFwYWNyQVBoZUtVc3RlOGV2ZXZldnVjSGFmZVRydVl1ZnJhYzpkOEM5ZVlVdkE2dUZ1YnJ1SmVnZXRyZVZ1dFJlQ1JVWQ==";
const DEFAULT_CLIENT_VERSION = "23.49.0 android";
const DEFAULT_USER_AGENT = "com.life360.android.safetymapd/KOKO";

/**
* The Life360 API URIs.
* - login URL
* - circles URL
*/
const LIFE360_URL = {
login: "https://api-cloudfront.life360.com/v3/oauth2/token.json",
login: "https://api-cloudfront.life360.com/v3/oauth2/token",
circles: "https://api-cloudfront.life360.com/v3/circles"
};

Expand Down Expand Up @@ -205,7 +205,9 @@ exports.connectLife360 = function(username, password, phone, countryCode) {
"Authorization": `Basic ${LIFE360_CLIENT_SECRET}`,
"Content-Type" : "application/json",
"X-Device-ID": deviceId,
"User-Agent": `${userAgent}/${clientVersion}/${deviceId}`
"User-Agent": `${userAgent}/${clientVersion}/${deviceId}`,
"Accept": "application/json",
"Cache-Control": "no-cache",
},
json: true
};
Expand Down Expand Up @@ -327,7 +329,9 @@ exports.getCircles = function(auth_in) {
"Authorization": `${auth_in.token_type} ${auth_in.access_token}`,
"Content-Type" : "application/json",
"X-Device-ID": deviceId,
"User-Agent": `${userAgent}/${clientVersion}/${deviceId}`
"User-Agent": `${userAgent}/${clientVersion}/${deviceId}`,
"Accept": "application/json",
"Cache-Control": "no-cache",
},
json: true
};
Expand Down Expand Up @@ -371,7 +375,9 @@ exports.getCircleById = function(auth_in, circleId) {
"Authorization": `${auth_in.token_type} ${auth_in.access_token}`,
"Content-Type" : "application/json",
"X-Device-ID": deviceId,
"User-Agent": `${userAgent}/${clientVersion}/${deviceId}`
"User-Agent": `${userAgent}/${clientVersion}/${deviceId}`,
"Accept": "application/json",
"Cache-Control": "no-cache",
},
json: true
};
Expand Down Expand Up @@ -582,7 +588,9 @@ exports.getCirclesAsync = async function(auth_in) {
"Authorization": `${auth_in.token_type} ${auth_in.access_token}`,
"Content-Type" : "application/json",
"X-Device-ID": deviceId,
"User-Agent": `${userAgent}/${clientVersion}/${deviceId}`
"User-Agent": `${userAgent}/${clientVersion}/${deviceId}`,
"Accept": "application/json",
"Cache-Control": "no-cache",
},
json: true
};
Expand Down Expand Up @@ -640,7 +648,9 @@ exports.getCircleMembersAsync = async function(auth_in, circleId) {
"Authorization": `${auth_in.token_type} ${auth_in.access_token}`,
"Content-Type" : "application/json",
"X-Device-ID": deviceId,
"User-Agent": `${userAgent}/${clientVersion}/${deviceId}`
"User-Agent": `${userAgent}/${clientVersion}/${deviceId}`,
"Accept": "application/json",
"Cache-Control": "no-cache",
},
json: true
};
Expand Down Expand Up @@ -698,7 +708,9 @@ exports.getCirclePlacesAsync = async function(auth_in, circleId) {
"Authorization": `${auth_in.token_type} ${auth_in.access_token}`,
"Content-Type" : "application/json",
"X-Device-ID": deviceId,
"User-Agent": `${userAgent}/${clientVersion}/${deviceId}`
"User-Agent": `${userAgent}/${clientVersion}/${deviceId}`,
"Accept": "application/json",
"Cache-Control": "no-cache",
},
json: true
};
Expand Down
Loading

0 comments on commit 9446197

Please sign in to comment.