问题描述
我目前正在测试的Facebook的OAuth的实现使用连接
I'm currently testing an OAuth implementation of facebook connect using http://facebooksdk.codeplex.com.
我有2个简单的动作FacebookController名为 LogOn支持和回调
I've got a FacebookController with 2 simple actions called LogOn and CallBack.
一切工作正常,用户正确登录到我的系统。
Everything works fine and the user is logged correctly into my system.
问题是,当回调动作被调用时,奇怪的事情发生,使一个简单的
The problem is when the CallBack action is called, something strange happens that makes a simple
return Redirect(loggedUrl);
重定向到正确的URL记录的但具有下列字符结尾:#_ = _
看来,Facebook的服务器使用下面的HTTP头将信息发送到我的web服务器:
It appears that the Facebook server sends the information to my webserver using the following HTTP header:
HTTP/1.1 302 Found
Cache-Control: private, no-cache, no-store, must-revalidate
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Location: http://mywebsite.com/Facebook/CallBack/?state=1&code=AQCXexr10uxANSBOu9JqrBDxqPkWbsyxM1S9ltuY9XwCXW7eGsOII329SthClxOSM_a7wJvwrXh1_O3D5I7E_nxCDTWDLpyYdMpMUfw4zMWcQ4oV2PmRkIMd2NfPYRKlkLgkurEzka1CjAF1jp8Xb3crklOB59W4IT7LZy6MEmFusuhSKacmsTcV1LAOW4uJ3K4#_=_
P3P: CP="Facebook does not have a P3P policy. Learn why here: http://fb.me/p3p"
Pragma: no-cache
Set-Cookie: locale=en_US; expires=Fri, 28-Oct-2011 00:09:38 GMT; path=/; domain=.facebook.com
Content-Type: text/html; charset=utf-8
X-FB-Server: 10.43.103.61
X-Cnection: close
Date: Fri, 21 Oct 2011 00:09:38 GMT
Content-Length: 0
正如你所看到的,我们可以找到#_ = _
在位置的结束字符值。
这就像重定向将被自动添加他们到loggedUrl考虑到#_ = _
字符。
It's like the Redirect was taking into account the #_=_
characters by adding them automatically to the loggedUrl.
甚至当我尝试用返回重定向(/);
的#_ = _
添加从(几乎)无处可我重定向的URL ...
Even when I try with return Redirect("/");
, the #_=_
is added from (almost) nowhere to my redirected url...
任何想法将是真正的AP preciated。
Any idea would be really appreciated.
在此先感谢任何答复。
问候,
LB
推荐答案
Facebook已经加入该#的 = 的人物他们响应的结束最近修改了自己的身份验证机制。在字符串末尾的#符号实际上是创造的问题。所以,你可以截断查询并做到这将正常工作重定向。
Facebook has modified their authentication mechanism recently by adding this #= characters to the end of their response. The # symbol at the end of the string is actually creating the problem. So you can either truncate the query and do the redirect which will work fine.
这篇关于Facebook的身份验证和奇怪的重定向行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!