简体   繁体   English

Facebook返回#access_token

[英]Facebook returns #access_token

I am using Java Scribe + Spring MVC to access Facebook authentication API. 我正在使用Java Scribe + Spring MVC访问Facebook身份验证API。

However, the URL with the access token I am getting back from Facebook is in this format: 但是,我从Facebook取回的带有访问令牌的URL的格式如下:

/facebookCallback#access_token=[long chunk]&expires_in=5028

As you can see, the access_token is preceded by a #, which disallows me from obtaining the access_code as a normal parameter. 如您所见,access_token前面有一个#,这使我无法获取access_code作为常规参数。

Is there any reason why Facebook is appending the # instead of a ? Facebook是否有任何理由要附加#而不是#?

var hash = document.location.hash;

我认为您的意思是Javascript,而不是Java Scribe?

you are probably using the callback parameter which is designed for the JS library. 您可能正在使用为JS库设计的回调参数。 Make sure you are not sending an incorrect parameter for "type". 确保您没有为“ type”发送错误的参数。

Turns out that it probably was caused by my school network. 原来,这可能是我的学校网络造成的。 I tried the exact same code both in school and at home and got different results (school - error, home - correct). 我在学校和家里尝试使用完全相同的代码,却得到了不同的结果(学校-错误,家庭-正确)。

The problem solved by itself the next day in school so I won't be able to find out exactly why. 第二天在学校自己解决了这个问题,所以我无法确切找到原因。 Thanks to those who helped. 感谢那些帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM