best way to get new access_token using PHP sdk

Posted by randy on Stack Overflow See other posts from Stack Overflow or by randy
Published on 2012-09-08T19:58:17Z Indexed on 2012/09/08 21:38 UTC
Read the original article Hit count: 270

I am getting the error "An active access token must be used to query information about the current user". There seems to be tons of articles and ideas, but am very confused and it seems that things are changing as well. A lot say to use offline-access but that appears to be going away. I did find this article.

Does anyone have an example using the PHP SDK?

I tried doing something like the below but it does not seem to work; $FBuser is still zero:

$token_url =    "https://graph.facebook.com/oauth/access_token?" .
                            "client_id=" . FB_APP_ID .
                            "&client_secret=" . FB_APP_SECRET .
                            "&grant_type=client_credentials";
list($name, $ACCESS_TOKEN) = explode("=", file_get_contents($token_url) );
$facebook->setAccessToken(ACCESS_TOKEN);
$FBuser = $facebook->getUser();

© Stack Overflow or respective owner

Related posts about php

Related posts about facebook-graph-api