我在我正在构建的库中使用Ueberauth来简化在 Phoenix 中添加身份验证。
我已经设置了一个示例 repo,您可以在v2 分支中看到代码
我现在正在尝试实施 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