ueberauth plug 无法分配 auth 和 failure to conn
Ueberauth plug fails to assign auth and failure to conn
我正在利用 Ueberauth in a library 我正在构建以简化 Phoenix 中身份验证的添加。
我设置了 example repo and you can see the code at in the v2 branch
我现在正在尝试实施 Ueberauth Identity 策略。看起来虽然我已经将 Ueberauth 插件添加到控制器,但 ueberauth_failure
和 ueberauth_auth
并没有在 conn 的 assigns
中设置。相反,conn.assigns
是 %{}
.
我希望通过此示例 curl 请求:
curl -i -X POST localhost:4000/identity/callback -d '{"user": {"email": "test@example.com", "password": "password"}}'
至少其中之一(ueberauth_failure
或 ueberauth_auth
)将被设置?
这里配置了 Ueberauth:https://github.com/britton-jb/test_sentinel_example/blob/master/config/config.exs#L58
执行该策略的控制器是https://github.com/britton-jb/sentinel/blob/v2/lib/sentinel/controllers/json/session_controller.ex
控制器和路由暴露在https://github.com/britton-jb/test_sentinel_example/blob/master/web/router.ex#L26
通过这个宏:https://github.com/britton-jb/sentinel/blob/v2/lib/sentinel.ex#L50
@hassox 建议正确的解决方案,ueberauth identity 的插件必须路由到 /auth/identity/
和 /auth/identity/callback
,只要我更改路由以反映一切正常。
我正在利用 Ueberauth in a library 我正在构建以简化 Phoenix 中身份验证的添加。
我设置了 example repo and you can see the code at in the v2 branch
我现在正在尝试实施 Ueberauth Identity 策略。看起来虽然我已经将 Ueberauth 插件添加到控制器,但 ueberauth_failure
和 ueberauth_auth
并没有在 conn 的 assigns
中设置。相反,conn.assigns
是 %{}
.
我希望通过此示例 curl 请求:
curl -i -X POST localhost:4000/identity/callback -d '{"user": {"email": "test@example.com", "password": "password"}}'
至少其中之一(ueberauth_failure
或 ueberauth_auth
)将被设置?
这里配置了 Ueberauth:https://github.com/britton-jb/test_sentinel_example/blob/master/config/config.exs#L58
执行该策略的控制器是https://github.com/britton-jb/sentinel/blob/v2/lib/sentinel/controllers/json/session_controller.ex
控制器和路由暴露在https://github.com/britton-jb/test_sentinel_example/blob/master/web/router.ex#L26
通过这个宏:https://github.com/britton-jb/sentinel/blob/v2/lib/sentinel.ex#L50
@hassox 建议正确的解决方案,ueberauth identity 的插件必须路由到 /auth/identity/
和 /auth/identity/callback
,只要我更改路由以反映一切正常。