Error while using pow_assent

The `:user` configuration option doesn't have a `:user_identities` association.

I had configured the project earlier to use Pow.

Now, trying to use Pow_Assent

I can see

[debug] Processing with PowAssent.Phoenix.AuthorizationController.callback/2
  Parameters: %{"code" => "somevalue", "provider" => "github", "state" => "somevalue"}
  Pipelines: [:browser]

in my terminal but right after it, the above error.

20220220100722_create_user_identities.exs

 create table(:user_identities) do
      add :provider, :string, null: false
      add :uid, :string, null: false
      add :user_id, references("users", on_delete: :nothing)

      timestamps()
    end

in user_identity.ex

schema "user_identities" do
    pow_assent_user_identity_fields()

    timestamps()
  end

What is missing?

It’s because the user_identities schema doesn’t have a user associated with it. It should have belongs_to with the user. Do you have that? or similarly, the user will have a has_many association with the user_identities.

also what is this? pow_assent_user_identity_fields()

from documentation

here,

use PowAssent.Ecto.UserIdentities.Schema, user: MyApp.Users.User does that belongs to operation.

as in the documentation here i had to use PowAssent.Ecto.Schema to account for has_many association that was missing.

Thanks for pointing it out. Silly of me!

1 Like