我正在尝试在使用 fb_graph(2.6.0) gem 创建内容时在 facebook 中分享,
我在尝试时遇到以下错误:
app = FbGraph::Application.new(APP_ID, :secret => APP_SECRET)
app.get_access_token
user = FbGraph::User.me(access_token).fetch
在开发控制台中
=> 377095675642525|X3SyfucEUnahEEFAFwkO_cFXRyc
1.9.3p194 :005 > user = FbGraph::User.me(access_token).fetch
LoadError: cannot load such file -- {"error":{"message":"An active access token must be used to query information about the current user.","type":"OAuthException","code":2500}}
from /home/love/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:234:in `load'
from /home/love/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:234:in `block in load'
from /home/love/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /home/love/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /home/love/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:223:in `load_dependency'
from /home/love/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.1.10/lib/active_support/dependencies.rb:234:in `load'
from /home/love/.rvm/gems/ruby-1.9.3-p194/gems/fb_graph-2.6.0/lib/fb_graph/node.rb:138:in `handle_response'
from /home/love/.rvm/gems/ruby-1.9.3-p194/gems/fb_graph-2.6.0/lib/fb_graph/node.rb:49:in `get'
from /home/love/.rvm/gems/ruby-1.9.3-p194/gems/fb_graph-2.6.0/lib/fb_graph/node.rb:19:in `fetch'
from (irb):5
from /home/love/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.1.10/lib/rails/commands/console.rb:45:in `start'
from /home/love/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.1.10/lib/rails/commands/console.rb:8:in `start'
from /home/love/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.1.10/lib/rails/commands.rb:40:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
在 Heroku 日志中:
Started GET "/facebook/callback?code=AQDccVXzo55GpSCCnr0vXKb2xpHFtJ8E_Eb-3AfA6Wcx5G1QEMHr4vNuH0366tGYVFepTuDZv2Z9_BLeXdMRNcLtfg1N3mz8rbTZowblEeGqg9Ls7R7X7P2GiuyFPJa0PTric7gjE8cZ3olRyP27otiGfzWQ4REoqS-BFsH4BwyfyZSiZxoQ0PPDUmlxeve4Cn9qAKzC2sYmEEbdTcPo2quu" for 122.164.241.1 at 2013-02-26 05:42:55 +0000
2013-02-26T05:42:56+00:00 app[web.1]: #<FbGraph::Auth:0x00000004e1bbb8 @client=# <Rack::OAuth2::Client:0x00000004e19b38 @identifier=188451457933295, @secret="13d6158a6ebe35a115bcae7f0ec14826", @redirect_uri=nil, @scheme=nil, @host="graph.facebook.com", @port=nil, @authorization_endpoint="/oauth/authorize", @token_endpoint="/oauth/access_token", @grant=# <Rack::OAuth2::Client::Grant::ClientCredentials:0x00000005484e28>>>
app/controllers/facebooks_controller.rb:29:in `create'
2013-02-26T05:42:56+00:00 heroku[router]: at=info method=GET path=/facebook/callback?code=AQDccVXzo55GpSCCnr0vXKb2xpHFtJ8E_Eb-3AfA6Wcx5G1QEMHr4vNuH0366tGYVFepTuDZv2Z9_BLeXdMRNcLtfg1N3mz8rbTZowblEeGqg9Ls7R7X7P2GiuyFPJa0PTric7gjE8cZ3olRyP27otiGfzWQ4REoqS-BFsH4BwyfyZSiZxoQ0PPDUmlxeve4Cn9qAKzC2sYmEEbdTcPo2quu host=x.y.com fwd="122.164.241.1" dyno=web.1 queue=0 wait=0ms connect=2ms service=431ms status=500 bytes=0
在facebook中单击登录后,我在浏览器中出现以下错误,
Server error
The website encountered an error while retrieving http://x.y.com/facebook/callback?code=AQAGIeV8GLZWMI98eauog2eTDq7jeXBEhBSDg3izqBBjS6mVN3y5tgTSGcagmAqMTYHyB_EJArN834cglLjBL4yHDQHlEaD7j7wSmSPN43hZXQhCHJTbvP0HHJPBwAiNCCZYOiP2jpLLAyznLoufwvN-6p6dLgjup8WPtRyEeUspv94m-O5lC146JHNvWFUvCHaPaQ2wPWyfmh5C89mR2G0R#_=_. It may be down for maintenance or configured incorrectly.