team-alembic / ash_authentication_phoenix

Drop-in authentication support for Phoenix apps using AshAuthentication.
MIT License
52 stars 23 forks source link

Sign in tokens enabled in context multitenancy fails registration, authentication #425

Closed carlgleisner closed 2 months ago

carlgleisner commented 2 months ago

Describe the bug Having sign_in_tokens_enabled? set to true in a context multitenancy setup causes registration and authentication to fail.

To Reproduce Please see this reproduction repo.

Expected behavior Expected the authentication to complete successfully.

Runtime

Additional context

[warning] Unhandled error in form submission for MyApp.Accounts.User.sign_in_with_password

This error was unhandled because Ash.Error.Invalid.TenantRequired does not implement the `AshPhoenix.FormData.Error` protocol.

** (Ash.Error.Invalid.TenantRequired) Queries against the MyApp.Accounts.User resource require a tenant to be specified

[warning] Unhandled error in form submission for MyApp.Accounts.User.sign_in_with_password

This error was unhandled because Ash.Error.Invalid.TenantRequired does not implement the `AshPhoenix.FormData.Error` protocol.

** (Ash.Error.Invalid.TenantRequired) Queries against the MyApp.Accounts.User resource require a tenant to be specified

[warning] Unhandled error in form submission for MyApp.Accounts.User.sign_in_with_password

This error was unhandled because Ash.Error.Invalid.TenantRequired does not implement the `AshPhoenix.FormData.Error` protocol.

** (Ash.Error.Invalid.TenantRequired) Queries against the MyApp.Accounts.User resource require a tenant to be specified

[warning] Unhandled error in form submission for MyApp.Accounts.User.sign_in_with_password

This error was unhandled because Ash.Error.Invalid.TenantRequired does not implement the `AshPhoenix.FormData.Error` protocol.

** (Ash.Error.Invalid.TenantRequired) Queries against the MyApp.Accounts.User resource require a tenant to be specified

Issue submission requested by @zachdaniel as per Discord exchange