To enable multitenency with Users I’ve modified the default User and Token Resources generated by Ash Authentication to declare context multitenency.
I have a Tenant Plug that adds the Tenant to the conn assigns from the host as well. When I do this the generated web UI works great
However, when I try the same thing with the API pipeline and calling sign_in_with_password/2 on User from a controller it fails. I’m wondering if this code supports tenants like the UI does or if I need to use a modified version of it.
I’m not sure where the WHERE (FALSE) is coming from:
SELECT u0."id", u0."email", u0."hashed_password", u0."confirmed_at" FROM "megahotel"."users" AS u0 WHERE (FALSE) []
AH, it’s from here:
query =
if is_nil(identity) do
# This will fail due to the argument being `nil`, so this is just a formality
Query.filter(query, false)
else
Query.filter(query, ^ref(identity_field) == ^identity)
end
So Query.get_argument(query, identity_field) is returning nil?
I should bring AshAuthentication in locally so I can debug better.