我正在尝试通过Graph API Explorer添加/发布real time updates订阅。这是我要求的POST网址
https://graph.facebook.com/v2.2/ {APP_ID} /订阅/对象=用户安培;字段=朋友&安培; verify_token = thisisaverifystring&安培;的access_token = my_app_token&安培; callback_url = http://mydomain/auth/facebook/callback/
但我收到了错误回复:
{ “错误”:{ “message”:“(#2200)回调验证失败:”, “type”:“OAuthException”, “代码”:2200 } }
此外,我在路由中两次定义了相同的回调URL,以处理GET和POST请求。我上面提到的API请求正在点击我的回调网址,但我在服务器日志中也遇到错误
在2015-02-12 19:24:12 +0530开始GET“/auth/facebook/callback/?hub.mode=subscribe&hub.challenge=246450618&hub.verify_token=thisisaverifystring”for 66.220.158.118
我,[2015-02-12T19:24:12.530395#18960] INFO - omniauth:(facebook)回调阶段已启动。
E,[2015-02-12T19:24:12.530916#18960]错误 - omniauth:(facebook)身份验证失败! no_authorization_code:OmniAuth :: Strategies :: Facebook :: NoAuthorizationCodeError,必须传递code
(通过网址或fbsr_XXX
已签名的请求Cookie)
OmniAuth :: Strategies :: Facebook :: NoAuthorizationCodeError(必须传递code
(通过网址或fbsr_XXX
已签名的请求Cookie)):
omniauth-facebook(2.0.0)lib / omniauth / strategies / facebook.rb:151:in with_authorization_code!'
omniauth-facebook (2.0.0) lib/omniauth/strategies/facebook.rb:71:in
callback_phase'
omniauth(1.2.2)lib / omniauth / strategy.rb:227:in callback_call'
omniauth (1.2.2) lib/omniauth/strategy.rb:184:in
call!'
omniauth(1.2.2)lib / omniauth / strategy.rb:164:in call'
omniauth (1.2.2) lib/omniauth/strategy.rb:186:in
call!'
omniauth(1.2.2)lib / omniauth / strategy.rb:164:in call'
omniauth (1.2.2) lib/omniauth/builder.rb:59:in
call'
rack(1.5.2)lib / rack / etag.rb:23:in call'
rack (1.5.2) lib/rack/conditionalget.rb:25:in
call'
rack(1.5.2)lib / rack / head.rb:11:in call'
remotipart (1.2.1) lib/remotipart/middleware.rb:27:in
call'
actionpack(4.1.8)lib / action_dispatch / middleware / params_parser.rb:27:in call'
actionpack (4.1.8) lib/action_dispatch/middleware/flash.rb:254:in
call'
rack(1.5.2)lib / rack / session / abstract / id.rb:225:in context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in
call'
actionpack(4.1.8)lib / action_dispatch / middleware / cookies.rb:560:在call'
actionpack (4.1.8) lib/action_dispatch/middleware/callbacks.rb:29:in
块中调用'
activesupport(4.1.8)lib / active_support / callbacks.rb:82:in run_callbacks'
actionpack (4.1.8) lib/action_dispatch/middleware/callbacks.rb:27:in
call'
actionpack(4.1.8)lib / action_dispatch / middleware / reloader.rb:73:in call'
actionpack (4.1.8) lib/action_dispatch/middleware/remote_ip.rb:76:in
call'
actionpack(4.1.8)lib / action_dispatch / middleware / debug_exceptions.rb:17:in call'
actionpack (4.1.8) lib/action_dispatch/middleware/show_exceptions.rb:30:in
call'
railties(4.1.8)lib / rails / rack / logger.rb:38:in call_app'
railties (4.1.8) lib/rails/rack/logger.rb:20:in
阻止呼叫'
activesupport(4.1.8)lib / active_support / tagged_logging.rb:68:in block in tagged'
activesupport (4.1.8) lib/active_support/tagged_logging.rb:26:in
tagged'
activesupport(4.1.8)lib / active_support / tagged_logging.rb:68:in tagged'
railties (4.1.8) lib/rails/rack/logger.rb:20:in
call'
actionpack(4.1.8)lib / action_dispatch / middleware / request_id.rb:21:in call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in
call'
rack(1.5.2)lib / rack / runtime.rb:17:in call'
activesupport (4.1.8) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in
call'
rack(1.5.2)lib / rack / lock.rb:17:in call'
actionpack (4.1.8) lib/action_dispatch/middleware/static.rb:84:in
call'
rack(1.5.2)lib / rack / sendfile.rb:112:in call'
railties (4.1.8) lib/rails/engine.rb:514:in
call'
railties(4.1.8)lib / rails / application.rb:144:in call'
rack (1.5.2) lib/rack/lock.rb:17:in
call'
rack(1.5.2)lib / rack / content_length.rb:14:in call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in
service'
/home/sshinde/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/webrick/httpserver.rb:138:in service'
/home/sshinde/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/webrick/httpserver.rb:94:in
run'
/home/sshinde/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/webrick/server.rb:295:in,clock in start_thread'
我假设验证令牌有问题,但我不知道如何获得此令牌。
请发表评论
答案 0 :(得分:0)
您的回调网址似乎没有实现您需要实际创建它。您正在使用来自OmniAuth的登录URL,这显然是在询问与您的订阅回调无关的代码或签名请求。
理想情况下,这些网址应该不同,我认为使用订阅回调网址重载您的登录网址端点没有任何直接好处。
在您的登录网址代码中,您是
吗?