rails omniauth facebook extended permission
Asked Answered
F

1

15

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?

Fortitude answered 25/11, 2010 at 9:29 Comment(0)
F
39

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"
Fortitude answered 26/11, 2010 at 8:22 Comment(2)
if you are using more than one :scope, use a comma separeted string: :scope => "offline_access,manage_pages"Hearne
Documentation for provider setup here: rubydoc.info/gems/oa-oauth/0.2.6/OmniAuth/Strategies/Facebook Permissions/scope available listed here: developers.facebook.com/docs/reference/api/permissionsSubtractive

© 2022 - 2024 — McMap. All rights reserved.