Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails “OAuth”;无效的验证码格式";_Ruby On Rails_Facebook Graph Api_Oauth - Fatal编程技术网

Ruby on rails “OAuth”;无效的验证码格式";

Ruby on rails “OAuth”;无效的验证码格式";,ruby-on-rails,facebook-graph-api,oauth,Ruby On Rails,Facebook Graph Api,Oauth,我有一个生产应用程序,偶尔会在日志中看到此错误。。我似乎无法在我这方面复制它,因此似乎有一个用户在某个地方有一些特定的设置/cookies/等导致了这个问题。我不确定。。。日志显示此用户已重定向到此回调url:“users/auth/facebook/callback?code=aqcayaaoforufgwbfg1d682j8dbxot0czynh3vvv5rtyklqgszisyn8ygtn25w_RTl3fu35cS1-tl5ArZ9B_xylworp0hgu6st8p6tyuzfir1m

我有一个生产应用程序,偶尔会在日志中看到此错误。。我似乎无法在我这方面复制它,因此似乎有一个用户在某个地方有一些特定的设置/cookies/等导致了这个问题。我不确定。。。日志显示此用户已重定向到此回调url:“users/auth/facebook/callback?code=aqcayaaoforufgwbfg1d682j8dbxot0czynh3vvv5rtyklqgszisyn8ygtn25w_RTl3fu35cS1-tl5ArZ9B_xylworp0hgu6st8p6tyuzfir1m0poasrkx-kbeviusm-Af0VJcUNTQPg-dm1f9y5cgj2bt2bjjjjjqhce9wylvkuy3kg3kgutq48ftt4-PhA/”

实际误差为:

RuntimeError: #<OAuth2::Response:0x1da7fae0 @error=#<OAuth2::Error: OAuth2::Error>, @options={:parse=>:query}, @parsed={"{\"error\":{\"message\":\"Invalid verification code format.\",\"type\":\"OAuthException\"}}"=>nil}, @response=#<Faraday::Response:0x1da8fa80 @on_complete_callbacks=[], @env={:response=>#<Faraday::Response:0x1da8fa80 ...>, :request_headers=>{"Content-Type"=>"application/x-www-form-urlencoded"}, :body=>"{\"error\":{\"message\":\"Invalid verification code format.\",\"type\":\"OAuthException\"}}", :status=>400, :url=>#<Addressable::URI:0xed52bf0 URI:https://graph.facebook.com/oauth/access_token>, :request=>{:proxy=>nil}, :parallel_manager=>nil, :response_headers=>{"expires"=>"Sat, 01 Jan 2000 00:00:00 GMT", "access-control-allow-origin"=>"*", "content-type"=>"text/javascript; charset=UTF-8", "connection"=>"close", "www-authenticate"=>"OAuth \"Facebook Platform\" \"invalid_code\" \"Invalid verification code format.\"", "date"=>"Thu, 13 Oct 2011 15:58:29 GMT", "content-length"=>"81", "cache-control"=>"no-store", "x-fb-rev"=>"457598", "x-fb-server"=>"10.65.13.60", "pragma"=>"no-cache"}, :ssl=>{:ca_file=>"/etc/pki/tls/certs/ca-bundle.crt"}, :method=>:post}>>
我知道如果我手动转到“users/auth/facebook/callback?code=blah”,它将触发相同的错误,因为callback code参数显然是假的,但看起来用户参数散列中的实际代码没有任何可疑之处,所以我想知道为什么它是无效格式


还有其他人经历过吗?

我想下面的链接提供了答案:

您首先需要使用您的客户端\u id和重定向\u uri进行调用。然后,这会将您重定向回redirect_uri,查询字符串中有一个验证代码,您可以将该代码传递给调用(通过code参数)以交换oAuth访问令牌


祝你好运!:)

你找到解决办法了吗?
{"code"=> "AQCayaAoFOruFgwbfg1D682j8DbxOt0CZYNH3Vv5RtYKlQgSzISyN8ygTn25W_RTl3fu35cS1-tl5ArZ9B_XylwORP0hGU6st8P6TyTYUzfiR1m0poaSRkX-KBeWiBvT6IUsm-Af0VJcUNTQPg-dM1F9y5CgJ2bTJEJqhCE9wYlvkUY3kguwcl3TQ48FTT4-PhA///",
"action"=>"",
"controller"=>""}