How to implement persistent session in SPA with Phoenix as API

Any idea how do I maintain an authenticated user with storing token in a cookie rather than localStorage?