简体   繁体   中英

How do i solve FbGraph::Unauthorized: OAuthException :: (#200) The user hasn't authorized the application to perform this action

I am getting error FbGraph::Unauthorized: OAuthException :: (#200) The user hasn't authorized the application to perform this action.My omniauth.rb look like this:

Rails.application.config.middleware.use OmniAuth::Builder do
 provider :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_SECRET'], {:scope => "offline_access, publish_stream, user_photos, publish_checkins, photo_upload"}
end

and my controller contains:

me = FbGraph::User.me(ACCESS_TOKEN)
me.feed!(
:message => 'Updating via FbGraph',
:picture => 'https://graph.facebook.com/matake/picture',
:link => 'https://github.com/nov/fb_graph',
:name => 'FbGraph',
:description => 'A Ruby wrapper for Facebook Graph API'
)

and i got this error:

FbGraph::Unauthorized: OAuthException :: (#200) The user hasn't authorized the application to perform this action
    from /home/usr/.rvm/gems/ruby-1.9.3-p194@usr/gems/fb_graph-2.5.5/lib/fb_graph/exception.rb:55:in `handle_httpclient_error'
    from /home/usr/.rvm/gems/ruby-1.9.3-p194@usr/gems/fb_graph-2.5.5/lib/fb_graph/node.rb:147:in `handle_response'
    from /home/usr/.rvm/gems/ruby-1.9.3-p194@usr/gems/fb_graph-2.5.5/lib/fb_graph/node.rb:55:in `post'
    from /home/usr/.rvm/gems/ruby-1.9.3-p194@usr/gems/fb_graph-2.5.5/lib/fb_graph/connections/feed.rb:15:in `feed!'
    from (irb):4
    from /home/usr/.rvm/gems/ruby-1.9.3-p194@usr/gems/railties-3.2.3/lib/rails/commands/console.rb:47:in `start'
    from /home/usr/.rvm/gems/ruby-1.9.3-p194@usr/gems/railties-3.2.3/lib/rails/commands/console.rb:8:in `start'
    from /home/usr/.rvm/gems/ruby-1.9.3-p194@usr/gems/railties-3.2.3/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Please solve my problem. I am using valid access_token Thanks

For what I see you are missing permissions in your scope try adding this one publish_actions,

Let me know if that solved your problem

是否添加了Javascript SDK

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM