Take the 2-minute tour ×

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();
        $payload = '';
        foreach ($args as $key => $value) {
                if ($key != 'sig') {
                return null;
        return $args;
        } else {
         return null;

I was the able to get the FB users access token as easily as


Now it doesn't seem that I'm able to retrieve this info anymore.

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'];

Any help is greatly appreciated.

share|improve this question

1 Answer 1

up vote 6 down vote accepted

it's because facebook change cookie name from fbs_ to fbsr_.

But there was more changes. Just follow this steps

share|improve this answer
Thanks for the suggestion. Changing the code to fbsr_ throws back the following php error "Message: Undefined index: sig" which is referring to this line in my code above "if (md5($payload . $application_secret) != $args['sig'])". Any ideas? –  Joshua Dec 16 '11 at 21:43
The best bet is to var_dump your $args to see what you actually have. –  Eric Dec 17 '11 at 5:46
there was more changes, check if this suggestions work: link –  Kokers Dec 17 '11 at 10:55
Kokers - that link worked like a charm! I had seen that new Oauth 2.0 authorization code before (on FB's site - developers.facebook.com/docs/authentication) and I had tried to convert in a similar manner, but couldn't get it to work. The link you provided saved me tons of time. If you want to re-post as an answer I will accept it. –  Joshua Dec 17 '11 at 18:46
Glad I could help. :o) I edited my answer. –  Kokers Dec 17 '11 at 19:06

Your Answer


