Ruby on rails - 如何解决 FbGraph::未经授权:OAuthException :: (#200) 用户尚未授权应用程序执行此操作



我收到错误 FbGraph::未经授权: 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谢谢

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

让我知道这是否解决了您的问题

你是否添加了Javascript SDK?

相关内容

  • 没有找到相关文章

最新更新