Guardian: current user is nil but EnsureAuthenticated gives me access

I’m having trouble debugging my authentication/authorization using Guardian and Ueberauth. This might be happening after I did a mix ecto.reset.

  • current_user from Guardian.Phoenix.Controller returns nil
  • Guardian.Plug.logged_in?(conn) returns false
  • Guardian.Plug.authenticated(conn) returns true
  • plug Guardian.Plug.EnsureAuthenticated gives me access

When I login/logout everything works as expected again.

It was my configuration. I was missing hooks: GuardianDb

1 Like

Hi @omin,

How did you fix this?
And where did you put this hook.

Thanks
Dev.

1 Like