Any way to store auth details in cookies using phoenix liveview

Im working on an E-commerce Phx App, I need to store some auth details like session and token in cookies, is there any way, need some suggestion

You can create a new app and use mix phx.gen.auth --live to see what it generates. In a nutshell, you can’t set cookies from a websocket, so we use phx-trigger-action to submit the form to an actual controller, which then stores everything accordingly.

1 Like

Okay, @josevalim. I’ll check it out. I was thinking of using the ETS table, just in case.

ETS table is tricky because it is single node only. You could of course store it in the database or have your session backed by a database though. :slight_smile:

1 Like