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

Token saved in session: check token and reconnect only if necessary (invalid token). #16

Open
ghost opened this issue Apr 15, 2014 · 4 comments

Comments

@ghost
Copy link

ghost commented Apr 15, 2014

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

@philihp
Copy link

philihp commented Apr 15, 2014

You could try making a call without any side effects, like getFriends().

@ghost
Copy link
Author

ghost commented Apr 15, 2014

If the person no friends? What's going on?
It is not preferable to use getUpdates()?

@philihp
Copy link

philihp commented Apr 15, 2014

I suppose you could do that too.

@ghost
Copy link
Author

ghost commented Apr 15, 2014

Ok! It would be nice to add a tokenIsValid() function in the future (next update).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant