1

我在我正在构建的库中使用Ueberauth简化在 Phoenix 中添加身份验证。

我已经设置了一个示例 repo,您​​可以在v2 分支中看到代码

我现在正在尝试实施 Ueberauth Identity 策略。看来,虽然我已将 Ueberauth 插件添加到控制器中ueberauth_failureueberauth_auth但 conn 的assigns. 相反,conn.assigns%{}

我期待这个示例 curl 请求:

curl -i -X POST localhost:4000/identity/callback -d '{"user": {"email": "test@example.com", "password": "password"}}'

至少其中一个(ueberauth_failureueberauth_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

4

1 回答 1

2

@hassox提出了正确的解决方案,必须将 ueberauth 身份的插头路由到/auth/identity/and /auth/identity/callback,只要我更改路由以反映一切正常。

于 2016-11-04T12:16:11.007 回答