tinderjs / tinder-desktop

Use Tinder from your desktop, for Mac OS X, Microsoft Windows and Linux
https://tinderjsblog.herokuapp.com/
97 stars 25 forks source link

Handle expiring Tinder tokens #91

Closed stuwil closed 8 years ago

stuwil commented 8 years ago

Currently, if a Tinder token is invalid/expired, we just log the user out.

This PR introduces the following changes:

  1. Stores the Facebook auth token, expiration time, and user ID on login.
  2. If the Tinder token expires, but the Facebook token is still valid, requests a new token from Tinder.
  3. If the Tinder token expires, and the Facebook token is no longer valid, redirect to the login page and flash the login window. (Only if localStorage already exists / the user hasn't logged out manually)
    • If the Facebook session is active, this will grab the new token and redirect back to the landing page.
    • If the Facebook session is no longer valid, the user will need to log into Facebook again.
  4. Otherwise, if something goes horribly wrong, we do a proper logout and invalidate the session/storage/cookies.
  5. Retains Settings on logout, as there's nothing personally identifiable in there.

A bit of an ugly hack, open to suggestions on this one.

Closes #21, closes #2.

mayeaux commented 8 years ago

Nice. Great commenting as well, very clear, will be easy to maintain over the longterm with that 👍