rails omniauth facebook extended permission

wizztjh picture wizztjh · Nov 25, 2010 · Viewed 8.8k times · Source

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?

Answer

wizztjh picture wizztjh · Nov 26, 2010

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"