Facebook cookie和oauth 2.0更改 [英] Facebook cookie and oauth 2.0 changes
问题描述
这个函数用于为我工作,直到另一天当Facebook决定实施一些变化。
This function used to work for me until the other day when facebook decided to enforce some changes.
function get_facebook_cookie() {
$app_id = '[MyAppID]';
$application_secret = '[MyAppSecrect]';
if(isset($_COOKIE['fbs_' . $app_id])){
$args = array();
parse_str(trim($_COOKIE['fbs_' . $app_id], '\\"'), $args);
ksort($args);
$payload = '';
foreach ($args as $key => $value) {
if ($key != 'sig') {
$payload .= $key . '=' . $value;
}
}
if (md5($payload . $application_secret) != $args['sig']) {
return null;
}
return $args;
} else {
return null;
}
}
我可以很容易地获得FB用户的访问令牌
I was the able to get the FB users access token as easily as
$cookie['access_token']
现在似乎无法检索此信息
Now it doesn't seem that I'm able to retrieve this info anymore.
我已经成功地(容易)能够对我的javascript代码进行必要的修改,但是我对php一边的感觉很糟糕。注意我使用codeigniter,我有很多麻烦,试图让FB PHP SDK玩得很好,我没有看到任何例子集成PHP 3 SDK到codeigniter,所以我正在寻找一个快速和脏的解决方案,这将允许我从cookie获得访问令牌,因此允许我使用以下调用Facebooks API:
I was successfully (easily) able to make the required changes to my javascript code, but I'm kind of stumped on the php side. As a quick side note I'm using codeigniter and I've had a lot of trouble trying to get the FB PHP SDK to play nice, also I havne't seen any examples of integrating the PHP 3 SDK into codeigniter so I'm looking for a quick and dirty solution that will allow me to get the access token from the cookie thus allowing me to use the following call to Facebooks API:
'https://api.facebook.com/method/friends.getAppUsers?access_token=' . $cookie['access_token'];
推荐答案
< >解决方案
这是因为Facebook将cookie名称从 fbs _
更改为 fbsr _
。
it's because facebook change cookie name from fbs_
to fbsr_
.
但有更多的变化。只需按照此步骤
But there was more changes. Just follow this steps
这篇关于Facebook cookie和oauth 2.0更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!