Isola92 / PartyScrobbler

1 stars 0 forks source link

Store Session Key #11

Open Isola92 opened 7 years ago

Isola92 commented 7 years ago

From last.fm:

Session keys have an infinite lifetime by default. You are recommended to store the key securely. Users are able to revoke privileges for your application on their Last.fm settings screen, rendering session keys invalid.

These keys could be written to a simple text-file together with the related user name. No real DB is needed since it's currently the only data that has to be stored between server lifetimes.

A user will still have to provide the session token (received from the user after approving site usage on www.last.fm) but I can save a few API-calls by not generating a new session key.

The new init-flow should be:

  1. Redirect user to last.fm.
  2. User approves my app.
  3. User is re-directed to site with token.
  4. Server checks if the user already has a session key.
  5. (Option 1) Server maps that session key to that user.
  6. (Option 2 ) Server generates a session key for that user.
  7. Life goes on.