I followed the AshAuthentication Auth0 guide
My understanding is that it needs to be followed after following the AshAuthenticationPhoenix guide.
The guide did not say which code to delete.
I deleted the hashed password code, because I will no longer use that.
I also deleted the Token
resource and all references to it, because my understanding was that it’s purpose is to be a password reset token, which my app will no longer handle.
This is the PR I ended up with
Password auth works on the main
branch, so this should just be the diff from password auth to Auth0.
Right now I get redirected to Auth0, redirected back to my app, but an error gets rendered on the redirect url.
Here is the stack trace:
Unknown Error
Context: resolving data on perform Red.Accounts.User.register_with_auth0
* Context: resolving data on perform Red.Accounts.User.register_with_auth0
** (ArgumentError) No identity found for Red.Accounts.User called :email
(ash 2.14.20) lib/ash/actions/create/create.ex:323: anonymous fn/11 in Ash.Actions.Create.as_requests/5
(ash 2.14.20) lib/ash/engine/request.ex:1111: Ash.Engine.Request.do_try_resolve_local/4
(ash 2.14.20) lib/ash/engine/request.ex:284: Ash.Engine.Request.do_next/1
(ash 2.14.20) lib/ash/engine/request.ex:213: Ash.Engine.Request.next/1
(ash 2.14.20) lib/ash/engine/engine.ex:712: Ash.Engine.advance_request/2
(ash 2.14.20) lib/ash/engine/engine.ex:637: Ash.Engine.fully_advance_request/2
(ash 2.14.20) lib/ash/engine/engine.ex:578: Ash.Engine.do_run_iteration/2
(elixir 1.15.4) lib/enum.ex:2510: Enum."-reduce/3-lists^foldl/2-0-"/3
(ash 2.14.20) lib/ash/engine/engine.ex:307: Ash.Engine.run_to_completion/1
(ash 2.14.20) lib/ash/engine/engine.ex:252: Ash.Engine.do_run/2
(ash 2.14.20) lib/ash/engine/engine.ex:148: Ash.Engine.run/2
(ash 2.14.20) lib/ash/actions/create/create.ex:111: Ash.Actions.Create.do_run/4
(ash 2.14.20) lib/ash/actions/create/create.ex:38: Ash.Actions.Create.run/4
(red 0.1.0) lib/red/accounts/accounts.ex:1: Red.Accounts.create/2
(ash_authentication 3.11.15) lib/ash_authentication/strategies/oauth2/plug.ex:64: AshAuthentication.Strategy.OAuth2.Plug.callback/2
(ash_authentication 3.11.15) lib/ash_authentication/plug/dispatcher.ex:29: AshAuthentication.Plug.Dispatcher.call/2
(phoenix 1.7.7) lib/phoenix/router.ex:430: Phoenix.Router.__call__/5
(red 0.1.0) lib/red_web/endpoint.ex:1: RedWeb.Endpoint.plug_builder_call/2
(red 0.1.0) deps/plug/lib/plug/debugger.ex:136: RedWeb.Endpoint."call (overridable 3)"/2
(red 0.1.0) lib/red_web/endpoint.ex:1: RedWeb.Endpoint.call/2