我如何解决FbGraph :: Unauthorized:OAuthException ::(#200)用户尚未授权应用程序执行此操作

时间:2013-02-01 08:15:30

标签: ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.2 omniauth fb-graph

我收到错误FbGraph :: Unauthorized:OAuthException ::(#200)用户未授权应用程序执行此操作。我的omniauth.rb如下所示:

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

我的控制器包含:

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'
)

我收到了这个错误:

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>'

请解决我的问题。我使用的是有效的access_token,谢谢

2 个答案:

答案 0 :(得分:1)

对于我看到您在范围内缺少权限的尝试,请尝试添加一个publish_actions,

如果这解决了您的问题,请告诉我

答案 1 :(得分:0)

您添加了Javascript SDK吗?