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 76 #77

Merged
merged 3 commits into from
Aug 1, 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
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,20 +121,34 @@ Feel free to modify the default timespan of 60 seconds for the polling interval.
## Changelog
<!--
Placeholder for the next version (at the beginning of the line):
### **WORK IN PROGRESS**
-->
### **WORK IN PROGRESS**
- (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)
- (MiGoller) Adopted Life360 API headers for Life360 API changes
- (MiGoller) Bumped dependencies
### 0.2.20 (2023-04-04)
* (MiGoller) Fix for issue #73: Uncaught exception
- (MiGoller) Fix for issue #73: Uncaught exception
### 0.2.19 (2022-11-09)
* (MiGoller) Fix for issue #64: Adapter v.0.2.18 fails to login
- (MiGoller) Fix for issue #64: Adapter v.0.2.18 fails to login
### 0.2.18 (2022-06-10)
* (MiGoller) Fix for issue #59: Adapter fails to authenticate after Life360 API changed.
- (MiGoller) Fix for issue #59: Adapter fails to authenticate after Life360 API changed.
### 0.2.17 (2021-11-21)
* (PeterVoronov) Fix for issue [#41: Fix for error in publishCirclePlaces "Cannot read property 'val' of null](https://github.com/MiGoller/ioBroker.life360/pull/41)
* (MiGoller) Fix for issue [#44: V 0.2.16 warnung no places found](https://github.com/MiGoller/ioBroker.life360/issues/44)
* (MiGoller) Fix for issue [#47: Keine Sonderzeichen möglich](https://github.com/MiGoller/ioBroker.life360/issues/47)
- (PeterVoronov) Fix for issue [#41: Fix for error in publishCirclePlaces "Cannot read property 'val' of null](https://github.com/MiGoller/ioBroker.life360/pull/41)
- (MiGoller) Fix for issue [#44: V 0.2.16 warnung no places found](https://github.com/MiGoller/ioBroker.life360/issues/44)
- (MiGoller) Fix for issue [#47: Keine Sonderzeichen möglich](https://github.com/MiGoller/ioBroker.life360/issues/47)
### 0.2.16 (2021-07-12)
Expand Down
33 changes: 24 additions & 9 deletions lib/life360CloudConnector.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ 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 = "U3dlcUFOQWdFVkVoVWt1cGVjcmVrYXN0ZXFhVGVXckFTV2E1dXN3MzpXMnZBV3JlY2hhUHJlZGFoVVJhZ1VYYWZyQW5hbWVqdQ==";
const LIFE360_CLIENT_SECRET = "YnJ1czR0ZXZhcHV0UmVadWNydUJSVXdVYnJFTUVDN1VYZTJlUEhhYjpSdUt1cHJBQ3JhbWVzV1UydVRyZVF1bXVtYTdhemFtQQ==";
const DEFAULT_CLIENT_VERSION = "22.6.0.532";
const DEFAULT_USER_AGENT = "SafetyMapKoko";

Expand All @@ -31,8 +31,8 @@ const DEFAULT_USER_AGENT = "SafetyMapKoko";
* - circles URL
*/
const LIFE360_URL = {
login: "https://www.life360.com/v3/oauth2/token.json",
circles: "https://www.life360.com/v3/circles"
login: "https://api-cloudfront.life360.com/v3/oauth2/token.json",
circles: "https://api-cloudfront.life360.com/v3/circles"
};

const min_polling_interval = 15; // Min polling interval in seconds
Expand Down Expand Up @@ -202,7 +202,7 @@ exports.connectLife360 = function(username, password, phone, countryCode) {
phone: phone
},
headers: {
"Authorization": `Authorization: Basic ${LIFE360_CLIENT_SECRET}`,
"Authorization": `Basic ${LIFE360_CLIENT_SECRET}`,
"Content-Type" : "application/json",
"X-Device-ID": deviceId,
"User-Agent": `${userAgent}/${clientVersion}/${deviceId}`
Expand Down Expand Up @@ -324,7 +324,10 @@ exports.getCircles = function(auth_in) {
const options = {
url: LIFE360_URL.circles,
headers: {
"Authorization": `${auth_in.token_type} ${auth_in.access_token}`
"Authorization": `${auth_in.token_type} ${auth_in.access_token}`,
"Content-Type" : "application/json",
"X-Device-ID": deviceId,
"User-Agent": `${userAgent}/${clientVersion}/${deviceId}`
},
json: true
};
Expand Down Expand Up @@ -365,7 +368,10 @@ exports.getCircleById = function(auth_in, circleId) {
const options = {
url: LIFE360_CIRCLE_URL,
headers: {
"Authorization": `${auth_in.token_type} ${auth_in.access_token}`
"Authorization": `${auth_in.token_type} ${auth_in.access_token}`,
"Content-Type" : "application/json",
"X-Device-ID": deviceId,
"User-Agent": `${userAgent}/${clientVersion}/${deviceId}`
},
json: true
};
Expand Down Expand Up @@ -573,7 +579,10 @@ exports.getCirclesAsync = async function(auth_in) {
const options = {
url: LIFE360_URL.circles,
headers: {
"Authorization": `${auth_in.token_type} ${auth_in.access_token}`
"Authorization": `${auth_in.token_type} ${auth_in.access_token}`,
"Content-Type" : "application/json",
"X-Device-ID": deviceId,
"User-Agent": `${userAgent}/${clientVersion}/${deviceId}`
},
json: true
};
Expand Down Expand Up @@ -628,7 +637,10 @@ exports.getCircleMembersAsync = async function(auth_in, circleId) {
const options = {
url: URL,
headers: {
"Authorization": `${auth_in.token_type} ${auth_in.access_token}`
"Authorization": `${auth_in.token_type} ${auth_in.access_token}`,
"Content-Type" : "application/json",
"X-Device-ID": deviceId,
"User-Agent": `${userAgent}/${clientVersion}/${deviceId}`
},
json: true
};
Expand Down Expand Up @@ -683,7 +695,10 @@ exports.getCirclePlacesAsync = async function(auth_in, circleId) {
const options = {
url: URL,
headers: {
"Authorization": `${auth_in.token_type} ${auth_in.access_token}`
"Authorization": `${auth_in.token_type} ${auth_in.access_token}`,
"Content-Type" : "application/json",
"X-Device-ID": deviceId,
"User-Agent": `${userAgent}/${clientVersion}/${deviceId}`
},
json: true
};
Expand Down
Loading