gpt4 book ai didi

ruby-on-rails - OAuth "Invalid verification code format"

转载 作者:行者123 更新时间:2023-12-04 02:30:12 25 4
gpt4 key购买 nike

我有一个生产应用程序,偶尔我会在日志中看到这个错误。我似乎无法复制它,所以似乎有一个用户在某个地方有一些特定的设置/cookies/等导致这个问题。 I am not sure... The log shows that this user was redirected to this callback url: "users/auth/facebook/callback?code=AQCayaAoFOruFgwbfg1D682j8DbxOt0CZYNH3Vv5RtYKlQgSzISyN8ygTn25W_RTl3fu35cS1-tl5ArZ9B_XylwORP0hGU6st8P6TyTYUzfiR1m0poaSRkX-KBeWiBvT6IUsm-Af0VJcUNTQPg-dM1F9y5CgJ2bTJEJqhCE9wYlvkUY3kguwcl3TQ48FTT4-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}>>

参数是:
{"code"=> "AQCayaAoFOruFgwbfg1D682j8DbxOt0CZYNH3Vv5RtYKlQgSzISyN8ygTn25W_RTl3fu35cS1-tl5ArZ9B_XylwORP0hGU6st8P6TyTYUzfiR1m0poaSRkX-KBeWiBvT6IUsm-Af0VJcUNTQPg-dM1F9y5CgJ2bTJEJqhCE9wYlvkUY3kguwcl3TQ48FTT4-PhA///",
"action"=>"",
"controller"=>""}

我知道如果我手动转到“users/auth/facebook/callback?code=blah”,它会触发同样的错误,因为回调代码参数显然是伪造的,但看起来对实际代码没有任何可疑之处用户的参数哈希 - 所以我想知道为什么它会是无效的格式?

有没有其他人经历过这个?

最佳答案

我认为以下链接提供了答案:http://developers.facebook.com/docs/authentication/#authenticating-users-in-a-web-application

您首先需要调用https://graph.facebook.com/oauth/authorize使用您的 client_id 和 redirect_uri。然后,这会将您重定向回 redirect_uri,并在查询字符串中提供一个验证码,您可以将其传递给您的 https://graph.facebook.com/oauth/access_token。调用(通过 code 参数)以交换 oAuth 访问 token 。

祝你好运! :)

关于ruby-on-rails - OAuth "Invalid verification code format",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7758085/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com