【问题标题】:Set different facebook oauth scope per user with devise使用设计为每个用户设置不同的 facebook oauth 范围
【发布时间】:2013-02-26 18:49:30
【问题描述】:

我有一个具有两种不同类型用户(称为 A 和 B)的 Rails 应用程序。现在他们都可以使用 facebook 登录。但是,我需要 B 能够使用一些扩展权限进行 oauth,并且我不希望 A 给我扩展权限。

在config/initializers/devise.rb里面

config.omniauth :facebook, "API_KEY", "API_SECRET", :client_options => {:ssl => {:ca_path => '  /path/to/my/ssl/stuff'}}

我知道我可以添加

:scope => "extended_permissions"

但我只希望在 B 用户注册时发生扩展权限。

由于这是在初始化程序中,这甚至可能吗?或者我可以在应用程序的其他地方以某种方式配置.omniauth 并保持设计满意吗?

【问题讨论】:

标签: ruby-on-rails facebook facebook-graph-api devise omniauth


【解决方案1】:

文档里解释的很清楚

如果要设置显示格式、auth_type 或范围 根据每个请求,您可以将其传递给 OmniAuth 请求阶段 URL,例如:/auth/facebook?display=popup 或 /auth/facebook?scope=email。

来源:https://github.com/mkdynamic/omniauth-facebook#per-request-options

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-07-21
    • 1970-01-01
    • 2012-02-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多