Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #83 #85

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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