bburtin / arlo-api

Netgear Arlo REST API documentation
35 stars 6 forks source link

Did the Arlo api just change? #1

Open rdkgit opened 6 years ago

rdkgit commented 6 years ago

Hi!

I wrote some nodejs code using your API spec and login seems to still work but none of the other API calls work anymore. No change in my code anymore. Wondering if they now require cookies or other ids. I inspected using Chrome web inspector and can't see anything obvious.

Thanks,

Bobby

rdkgit commented 6 years ago

I ended up resolving the issue by having my code set the cookies based on the reply from the login API. That is, once login succeeds, subsequent API calls need to set both the authentication token and the session cookies. I think this changed about a week ago based on my logfiles.

bburtin commented 6 years ago

Sorry for the delay in responding. I haven't messed with the Arlo API for a while. It's likely that they changed it. You're welcome to send a pull request for updating the README in this repo. Thanks!

soensw commented 6 years ago

@rdkgit Hi Bobby, I have the same problem. Also with nodejs code. Good to hear you managed to solve it. Could you give me a bit more information how to implement the session cookies solution?

Wim

rdkgit commented 6 years ago

Hi!

Yes, in my code, after I post the login url, I take the returned values and grab the response.headers['set-cookie'] value and put that in my subsequent queries.

client.post(loginURL,loginArgs,function(data,response) { //console.log(data); if (data.success == false) { if (verbose) { console.log("Login failed, error " +data.data.error +", check username/password"); } } else { //console.log("Login succeeded, token: "+data.data.token); if (verbose) { console.log("Login succeeded, token "+data.data.token); console.log("Data success "+data.success);
console.log("Authenticated: "+data.data.authenticated); console.log("Account Status: "+data.data.accountStatus); console.log("Cookies :"+response.headers['set-cookie']); } } // response is complete, raw response //console.log(response);

var token = data.data.token;
var cookies = response.headers['set-cookie'];

queryArgs.headers = {
// 'Content-Type': "application/json",
'Accept': 'application/json, text/plain, */*',
'Accept-Encoding': 'gzip, deflate, br',
    'Accept-Language': 'en-US,en;q=0.9',
    'Authorization': data.data.token,
'Referer': 'https://arlo.netgear.com/',
'User-Agent': 'arloclient',
'Cookie': cookies,
};

var aURL = getDevicesURL
client.get(aURL,queryArgs,function(data,response) {

});
soensw commented 6 years ago

Yes! Works perfect. Thanks Bobby, you rock! ;-)

songlining commented 6 years ago

I also encountered same issue, with python.

The workaround for me was to use requests.Session() (import requests). I believe it handles the cookie automatically.

rdkgit commented 6 years ago

Thanks.

jeffreydwalter commented 6 years ago

You guys should just use my library https://github.com/jeffreydwalter/arlo It's fully featured and I make an attempt at keeping up with new Arlo APIs (as they are discovered).

Cheers!