Search code examples
phoenix-frameworkueberauth

Ueberauth plug fails to assign auth and failure to conn


I'm utilizing Ueberauth in a library I'm building to simplify the addition of authentication in Phoenix.

I've setup an example repo and you can see the code at in the v2 branch

I’m attempting to implement the Ueberauth Identity strategy right now. It appears that although I’ve added the Ueberauth plug to the controller, the ueberauth_failure and ueberauth_auth are not being set in the conn’s assigns. Instead, conn.assigns is %{}.

I’m expecting that with this example curl request:

curl -i -X POST localhost:4000/identity/callback -d '{"user": {"email": "[email protected]", "password": "password"}}'

at least one of those (ueberauth_failure or ueberauth_auth) will be set?

Ueberauth is configured here: https://github.com/britton-jb/test_sentinel_example/blob/master/config/config.exs#L58

The controller implementing the strategy is https://github.com/britton-jb/sentinel/blob/v2/lib/sentinel/controllers/json/session_controller.ex

The controller and route are exposed in https://github.com/britton-jb/test_sentinel_example/blob/master/web/router.ex#L26

by this macro: https://github.com/britton-jb/sentinel/blob/v2/lib/sentinel.ex#L50


Solution

  • @hassox suggested the correct solution, ueberauth identity's plug must be routed to /auth/identity/ and /auth/identity/callback, as soon as I changed the routing to reflect this everything worked.