Phoenix.Token encryption

This is exactly what I imagined… :smiling_imp:
My goal is to build a phoenix project that exposes an API (for a mobile app later on) and also serves a SPA (React) .
So I was thinking that I could probably do the register/login part with plain old server-rendered html forms (using form_for) to prevent CSRF attacks and after a successful login redirect to the SPA (something like "/app") passing down a Phoenix.Token through window.userToken that only stores the user’s ID.
After that the SPA would connect to a Phoenix.Channel and interact with the API only via the channel, using the token for authorization/authentication.

Even if I don’t save the token in localStorage and save it in-memory (redux store), it may still be possible that the token might be leaked in someway from the Javascript application I think…

I wonder what is the best way to achieve the behaviour I mentioned above (SPA consuming the API via Phoenix.Channels)… :confounded: :confounded:

P.S. I am considering https and wss as standards… :smiley_cat: