2010-11-25 150 views
15

我已阅读omniauth的OAuth的RDoc轨omniauth Facebook的扩展权限

@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现在...有没有人有更好的解决方案?

回答

39

在初始化

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

将这个如果你使用一个以上的范围,它以逗号分隔:

:scope => "offline_access, manage_pages" 
+1

感谢。 – 2010-12-01 12:24:21