15

我已经阅读了omniauth oauth rdoc

  @consumer = OAuth::Consumer.new(key, secret, {
    :site               => "http://term.ie",
    :scheme             => :header,
    :http_method        => :post,
    :request_token_path => "/oauth/example/request_token.php",
    :access_token_path  => "/oauth/example/access_token.php",
    :authorize_path     => "/oauth/example/authorize.php"
   })

没有范围,例如

https://graph.facebook.com/oauth/authorize?
    client_id=...&
    redirect_uri=http://www.example.com/callback&
    scope=user_photos,user_videos,publish_stream

如何添加一个?我现在正在尝试覆盖 oauth ... 有人有更好的解决方案吗?

4

1 回答 1

39

把它放在初始化器中

Rails.application.config.middleware.use OmniAuth::Builder do
    provider :facebook , 'app' , 'secret' , {:scope => "manage_pages"}
end

如果您使用多个范围,则以逗号分隔:

:scope => "offline_access, manage_pages"
于 2010-11-26T08:22:07.493 回答