Pow mnesia persistent sessions does not keep me logged in

Hi All

I can’t seem to get persistent sessions working in POW. I’ve created a boilerplate repo with my setup (Here’s the link to a list of files changed related to POW configuration Github repo

I’ve configured it with mnesia, and I’ve set the mnesia path to a fixed path, and it seems to write data to that path. I’ve tried to follow the guides on making the system production-ready.

I am not showing a checkbox in the login template. As I understand, it is not necessary.

This happens both in dev mode and in prod mode.

Can anybody spot what is going on? I’m using it on multiple apps, and they all suffer from the same problem.

Thanks in advance :smile:

You’re missing the controller callbacks:

config :phoenix_boilerplate, :pow,
  user: PhoenixBoilerplate.Users.User,
  repo: PhoenixBoilerplate.Repo,
  cache_store_backend: Pow.Store.Backend.MnesiaCache,
  extensions: [PowPersistentSession],
  controller_callbacks: Pow.Extension.Phoenix.ControllerCallbacks   

Without it, the callbacks in the PowPersistentSession extension isn’t called when users sign in or register so that’s why the session doesn’t persist.

2 Likes

How did I miss that :smile: Thank you so much for helping me. It seems to have solved the problem.

1 Like