Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails omniauth facebook extended permission

I have read the 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"
   })

there is no scope such as

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

How do I add one? I am trying to overwrite oauth now ... do anyone got any better solution?

like image 847
wizztjh Avatar asked Nov 25 '10 09:11

wizztjh


1 Answers

Put this in initializer

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

If you are using more than one scope, it's comma delimited:

:scope => "offline_access, manage_pages"
like image 96
wizztjh Avatar answered Oct 21 '22 05:10

wizztjh