I'm trying to add/publish a subscription for real time updates via Graph API Explorer. Here is my requested POST url
https://graph.facebook.com/v2.2/{app_id}/subscriptions/?object=user&fields=friends&verify_token=thisisaverifystring&access_token=my_app_token&callback_url=http://mydomain/auth/facebook/callback/
But I'm getting error response:
{ "error": { "message": "(#2200) callback verification failed: ", "type": "OAuthException", "code": 2200 } }
Also I have defined same callback URL twice in my routes to handle GET as well as POST requests. My API request mentioned above is hitting my callback url but I'm also getting error in server logs
Started GET "/auth/facebook/callback/?hub.mode=subscribe&hub.challenge=246450618&hub.verify_token=thisisaverifystring" for 66.220.158.118 at 2015-02-12 19:24:12 +0530
I, [2015-02-12T19:24:12.530395 #18960] INFO -- omniauth: (facebook) Callback phase initiated.
E, [2015-02-12T19:24:12.530916 #18960] ERROR -- omniauth: (facebook) Authentication failure! no_authorization_code: OmniAuth::Strategies::Facebook::NoAuthorizationCodeError, must pass either a code
(via URL or by an fbsr_XXX
signed request cookie)
OmniAuth::Strategies::Facebook::NoAuthorizationCodeError (must pass either a code
(via URL or by an fbsr_XXX
signed request 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:in call'
actionpack (4.1.8) lib/action_dispatch/middleware/callbacks.rb:29:in
block in call'
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
block in call'
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 `block in start_thread'
I'm assuming here is something wrong with the verify token but I'm not sure how can I get this token.
Please comment