2010-11-25 147 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