I am struggling here to add some LiveView to a regular phoenix app.
In a non-live route I use plugs to add to
conn every bit of information required to auth and other things related to the user, like feature-flags, settings, tokes, etc this has been working well so far.
As Liveview uses sockets this cannot work the same way, but I cannot find which is the best option to keep this data accessible in
handle_event without querying the DB or the external APIs each time.
As a basic use case, once the user authenticate (by using an external service) it receives a jwt token, I need to use that token to do some queries to external APIs, this token is never used in render time, this is not a bi piece of data, but I have other maps that are quite big (like feature flags) also I will like to avoid to “leak” unnecesary data to client-side to be ont he safe side of things.