{"action":"created","issue":{"url":"https://api.github.com/repos/mkdynamic/omniauth-facebook/issues/110","labels_url":"https://api.github.com/repos/mkdynamic/omniauth-facebook/issues/110/labels{/name}","comments_url":"https://api.github.com/repos/mkdynamic/omniauth-facebook/issues/110/comments","events_url":"https://api.github.com/repos/mkdynamic/omniauth-facebook/issues/110/events","html_url":"https://github.com/mkdynamic/omniauth-facebook/issues/110","id":11222489,"number":110,"title":"NoAuthorizationCodeError when accessing the app from Facebook","user":{"login":"woniesong92","id":2935309,"avatar_url":"https://avatars.githubusercontent.com/u/2935309?v=3","gravatar_id":"","url":"https://api.github.com/users/woniesong92","html_url":"https://github.com/woniesong92","followers_url":"https://api.github.com/users/woniesong92/followers","following_url":"https://api.github.com/users/woniesong92/following{/other_user}","gists_url":"https://api.github.com/users/woniesong92/gists{/gist_id}","starred_url":"https://api.github.com/users/woniesong92/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woniesong92/subscriptions","organizations_url":"https://api.github.com/users/woniesong92/orgs","repos_url":"https://api.github.com/users/woniesong92/repos","events_url":"https://api.github.com/users/woniesong92/events{/privacy}","received_events_url":"https://api.github.com/users/woniesong92/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2013-02-21T00:27:03Z","updated_at":"2015-10-11T23:44:52Z","closed_at":null,"body":"OmniAuth::Strategies::Facebook::NoAuthorizationCodeError\r\n\r\nmust pass either a code parameter or a signed request (via signed_request parameter or a fbsr_XXX cookie)\r\n\r\nThis error occurs with the latest version of omniauth.\r\n1. omniauth-facebook-1.4.1\r\n2. omniauth-oauth2-1.1.1\r\n3. omniauth-1.1.3\r\n\r\nThere are closed issues like #65 and #87 but it seems the source of problem is different now since my site URL is correctly set to http://example.com\r\n\r\nomniauth.rb:\r\n\r\n```\r\nRails.application.config.middleware.use OmniAuth::Builder do\r\n  provider :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET'], :scope => 'email', :provider_ignores_state => true\r\nend\r\n```\r\n\r\nInitialization:\r\n\r\n```javascript\r\n    window.fbAsyncInit = function() {\r\n      FB.init({\r\n        appId      : <%= ENV['FACEBOOK_KEY'] %>, // App ID\r\n        status     : true, // check login status\r\n        cookie     : true, // enable cookies to allow the server to access the session\r\n        xfbml      : true  // parse XFBML\r\n      });\r\n    };\r\n\r\n    // Load the SDK Asynchronously\r\n    (function(d){\r\n       var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];\r\n       if (d.getElementById(id)) {return;}\r\n       js = d.createElement('script'); js.id = id; js.async = true;\r\n       js.src = \"//connect.facebook.net/en_US/all.js\";\r\n       ref.parentNode.insertBefore(js, ref);\r\n     }(document));\r\n```\r\n\r\nAnd I use the client-side authorization with server-side authorization.\r\n\r\nview\r\n```javascript\r\nfunction login() {\r\n  FB.login(function(response) {\r\n    if (response.authResponse) {\r\n      window.location = '/auth/facebook/callback'\r\n    } \r\n  }, {scope: 'email,publish_stream,publish_actions'});\r\n}\r\n```\r\n\r\nroutes\r\n```\r\n  match 'auth/:provider/callback', to: 'sessions#create_facebook'\r\n  match 'auth/failure', to: redirect('/')\r\n```\r\n\r\nThis error only occurs when I try to sign in\r\n**Inside Facebook, using Internet Explorer.** Chrome, Firefox do not have any problem, and even Internet Explorer is fine if I access the app from outside Facebook.\r\nThere is still an open discussion at #56 with the same error, but I'm not sure if that's the same problem as this one.\r\n"},"comment":{"url":"https://api.github.com/repos/mkdynamic/omniauth-facebook/issues/comments/147255803","html_url":"https://github.com/mkdynamic/omniauth-facebook/issues/110#issuecomment-147255803","issue_url":"https://api.github.com/repos/mkdynamic/omniauth-facebook/issues/110","id":147255803,"user":{"login":"urbanvikingr","id":12019797,"avatar_url":"https://avatars.githubusercontent.com/u/12019797?v=3","gravatar_id":"","url":"https://api.github.com/users/urbanvikingr","html_url":"https://github.com/urbanvikingr","followers_url":"https://api.github.com/users/urbanvikingr/followers","following_url":"https://api.github.com/users/urbanvikingr/following{/other_user}","gists_url":"https://api.github.com/users/urbanvikingr/gists{/gist_id}","starred_url":"https://api.github.com/users/urbanvikingr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urbanvikingr/subscriptions","organizations_url":"https://api.github.com/users/urbanvikingr/orgs","repos_url":"https://api.github.com/users/urbanvikingr/repos","events_url":"https://api.github.com/users/urbanvikingr/events{/privacy}","received_events_url":"https://api.github.com/users/urbanvikingr/received_events","type":"User","site_admin":false},"created_at":"2015-10-11T23:44:52Z","updated_at":"2015-10-11T23:44:52Z","body":"Anybody seen this error?\r\n`{\"error\":{\"message\":\"Invalid verification code format.\",\"type\":\"OAuthException\",\"code\":100,\"fbtrace_id\":\"Fx6\\/Dg4zcKE\"}}`\r\n\r\nI succeed to pass the signed request from JavaScript client on localhost:8080 to Rails API on localhost:3000 using Facebook's client-side login flow. The url is `http://localhost:3000/api/auth/facebook/callback?code=response.authResponse.signedRequest`.\r\n\r\nI'm using jQuery to set url params\r\n`http://localhost:3000/api/auth/facebook/callback? + $.param({ code: response.authResponse.signedRequest });`\r\n\r\nNow, I am getting the error mentioned above. It is returned from Facebook upon the Omniauth call, if I'm reading the Omniauth documentation correctly. \r\n\r\n```\r\nHow it Works\r\n\r\nThe client-side flow is supported by parsing the authorization code from the signed request which Facebook places in a cookie.\r\n\r\nWhen you call /auth/facebook/callback in the success callback of FB.login that will pass the cookie back to the server. omniauth-facebook will see this cookie and:\r\n\r\nparse it,\r\nextract the authorization code contained in it\r\nand hit Facebook and obtain an access token which will get placed in the request.env['omniauth.auth']['credentials'] hash.\r\n```"}}