php-snapchat
php-snapchat copied to clipboard
Token saved in session: check token and reconnect only if necessary (invalid token).
Hello,
I save the object "$snapchat" in session with this method: http://www.php.net/manual/en/oop4.serialization.php This avoids having to redo a connection (with a new token) on Snapchat servers at each change of page.
But if I connect to Snapchat with mobile application, it makes a new connection and changes the token. So, the old token saved in PHP session (on my website) is no longer valid.
My question is the following: How to check if the token is still valid? If it is still valid, use it normally. But, if it is no longer valid, make a new connection (reconnect with the login() function).
Thank you in advance.
Best regards, Yoann
You could try making a call without any side effects, like getFriends().
If the person no friends? What's going on? It is not preferable to use getUpdates()?
I suppose you could do that too.
Ok! It would be nice to add a tokenIsValid() function in the future (next update).