PHP getAccessToken

From Facebook Developer Wiki (FbDevWiki.com)
Jump to: navigation, search

Gets an OAuth access token. If there is currently a user logged in (a valid session) then it will return the access token from that session, otherwise it will create an application signed token.

You usually don't need no call this method directly as the other PHP SDK methods will call this automatically if needed.

    <?php

    require './facebook.php';

    $facebook = new Facebook(array(
      'appId'  => 'YOUR APP ID',
      'secret' => 'YOUR API SECRET',
      'cookie' => true, // enable optional cookie support
    ));

    $access_token = $facebook->getAccessToken();

Personal tools
Namespaces
Variants
Actions
Navigation
Graph API
FQL
Toolbox