facebook错误'验证码验证错误' [英] facebook error 'Error validating verification code'
问题描述
很奇怪的错误。我使用gide http://developers.facebook.com/docs/authentication/ 。所以我创建请求到fb并通过redirect_uri。我在本地主机上使用测试站点。所以如果我通过
very strange error. i use gide http://developers.facebook.com/docs/authentication/. so i create request to fb and pass redirect_uri. i use test site on localhost. so if i pass
redirect_uri = http://localhost/test_blog/index.php
它工作正常,但如果我通过
it works fine, but if i pass
redirect_uri = http://localhost/test_blog/index.php?r = site / oauth2
它不想要工作。我尝试使用
it don't want work. i try to use
redirect_uri =。
urlencode(' http://localhost/test_blog/index.php?r = site / oauth2 )
但不工作。
我尝试解释。我成功获得代码,但是当我访问 https://graph.facebook.com/me?access_token我收到错误'验证验证码错误'。我检查过,错误在?r = site / oauth2 ,但是我需要传递一些参数
可以帮助我吗?
i阅读帖子 http://forum.developers.facebook.net/viewtopic
but not work. i try to explaine. i success get code, but when i access https://graph.facebook.com/me?access_token i get error 'Error validating verification code'. i checked evering, error is in ?r=site/oauth2 but i need passing some params can somebody help me? i read post http://forum.developers.facebook.net/viewtopic.php?id=70855 but nothing work for me
推荐答案
目前(截至2011年3月)无证件关于什么使一个有效的redirect_uri的要求。
There are presently (as of March 2011) undocumented requirements regarding what makes a valid redirect_uri.
首先,两个redirect_uri参数授权和access_token都必须匹配。
显然Facebook(或者说OAuth2)正在使用redirect_uri作为内部密钥来对access_token请求返回的代码进行编码。自从验证回到您的网站后,它有点聪明。这解释了为什么access_token请求不需要redirect_uri参数需要一个。
Apparently Facebook (or rather OAuth2) is using the redirect_uri as a internal key to encode the code returned for the access_token request. It's kinda clever since it verifies back to your site. It explains why the access_token request which wouldn't otherwise need a redirect_uri parameter requires one.
其次,你不能在redirect_uri中使用许多特殊字符。
很多讨论都鼓吹参数是否可以传递。他们可以,限制哪些字符是有效的,但没有人发布我知道的列表。诸如url / html编码的传统方法将失败,因为百分比(%)无效。斜杠(/)无效,因此嵌套重定向网址始终会失败。克服特殊字符限制的唯一方法是将参数的值编码为base64。如果您使用ASP.NET,请查看Convert.ToBase64。
A lot of discussion rages whether parameters can be passed at all. They can, you're limited which characters are valid but no one has published a list that I know. Traditional methods like url/html encoding will fail because percent(%) is not valid. Slash (/) is not valid either so a nested redirection url will always fail. The ONLY way to overcome the special char limitation is to encode the value of the parameter to base64. If you're using ASP.NET, look up Convert.ToBase64.
最后,这更多是一个备注。有很多程序员传递错误信息,一个简单的解决方案是传递type = client_cred。这可能会限制您访问您在授权中请求的某些权限。这是不合适的。
Lastly, and this is more of a side-note. There are a lot of programmers passing along misinformation that a simple solution is to pass type=client_cred. This may limit your access to some of the permissions you requested in your authorization. It is inadvisable.
这篇关于facebook错误'验证码验证错误'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!