Skip to content

Commit

Permalink
Updated Life360 API wrapper headers
Browse files Browse the repository at this point in the history
  • Loading branch information
MiGoller committed Aug 1, 2023
1 parent 06e74ef commit 540067e
Showing 1 changed file with 24 additions and 9 deletions.
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

0 comments on commit 540067e

Please sign in to comment.