我可以使用方法 FB.getLoginStatus()
在asp.net mvc应用程序的客户端获取facebook访问令牌令牌:
EAAFjVDcBGp4BABSnPzvjeR0ZCqEHExSRIGtvEIMPZCZABh **** fk03WZCg10xaPJUs3ZCZAMTnP8
将令牌设置为Cookie。我想在服务器端访问它,但在服务器上我得到它:
Kk9fbM-3d8ih4SpCfMddsj23BW2bqwPlll9LLs8ZYUE.eyJh **** IjEwNzI4NDM4NjQ0OTI5MiJ9
为什么呢?我该怎么办才能从cookie中获取令牌?
已更新
客户代码:
function checkLoginState() {
FB.getLoginStatus(function(response) {
if (response.status === 'connected')
return;
FB.login();
});
}
window.fbAsyncInit = function() {
FB.init({
appId: @ConfigurationManager.AppSettings[AppParameterKey.FbApplicationId],
cookie : true,
xfbml : true,
version : 'v2.8'
});
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
服务器代码:
var userToken = HttpContext.Current.Request.Cookies[String.Concat("fbsr_", ConfigurationManager.AppSettings[AppParameterKey.FbApplicationId])].Value
答案 0 :(得分:0)