JorgenPhi / php-snapchat

A PHP library for the Snapchat API - With Commit History
MIT License
259 stars 73 forks source link

Detecting if users has logged into Snapchat app #34

Open martynball opened 10 years ago

martynball commented 10 years ago

I have noticed that if you log into the Snapchat app, then try and use the username and auth_token with this API you can no longer get any snapchats as the app just made a new auth_token.

What would be the best way to detect that this has happened? If I do a check to see if any Snaps have been retrieved to see if the API auth_token is still valid I could get false results as there simply could be no new snaps.

Only way I can think of doing it is to see if the "cache" object in the Snapchat object has any contents as I noticed that it is empty if you login the app without logging back into the API.

Ideas?

Grandnainconnu commented 10 years ago

I have made one function on snapchat.php :

public function isLogged() { $cache = $this->getUpdates();

return ($cache AND $cache->logged == true) ? true : false;

}

gabrielsoldani commented 10 years ago

This is a duplicate of #16.