Add refresh token functionality
Currently we simply store a login token in localstorage.
This can be problematic because:
- localstorage could potentially be compromised
- from a UX point of view, when the token expires, the user gets logged out
The solution could be along the following lines:
- Store a long term cookie
- The cookie is used by the server to issue short-lived, 15 min tokens
- The tokens are stored in-memory
- Right before a token expires, it fetches a new token from the server and replaces the old one