Pow login error

Hi all,

I’ve followed this tutorial to set up authentication with Pow and everything was working perfectly. At one point I started adding and removing users (at least that’s when I think I ran into problems) and out of nowhere, I’m getting an error when I call Pow.Plug.authenticate_user(conn, %{"email": "some@email.com", "password" => "secret123"}). I get a Bad Request response and here is what I’m seeing in the logs:

[debug] Processing with MyAppWeb.Api.V1.SessionController.create/2
  Parameters: %{"user" => %{"email" => "test1@mail.com", "password" => "[FILTERED]"}}
  Pipelines: [:api]
[debug] QUERY OK source="users" db=33.0ms queue=1.3ms idle=1968.8ms
SELECT u0."id", u0."password_hash", u0."email", u0."inserted_at", u0."updated_at" FROM "users" AS u0 WHERE (u0."email" = $1) ["test1@mail.com"]
[info] Sent 400 in 97ms
[debug] Converted error Ecto.Query.CastError to 400 response

If I run Repo.get_by(User, email: "test1@mail.com") I do get the right user and I call also successfully verify their password with Pow.Ecto.Schema.Password.pbkdf2_verify, so I’m not sure why Pow is giving me a bad response now. Any help would be highly appreciated. I’ve tried resetting my DB, but that didn’t help.

Many thanks!

Resolved it. I had a method inside MyApp.Users.User called verify_password and it seems to have conflicted with Pow’s internal logic, so just renaming it fixed the problem for me.