Ankündigung

Einklappen
Keine Ankündigung bisher.

[Erledigt] Facebook Access tokken wird nicht erkannt

Einklappen

Neue Werbung 2019

Einklappen
X
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • [Erledigt] Facebook Access tokken wird nicht erkannt

    PHP-Code:
    define('DS'DIRECTORY_SEPARATOR);
    require_once 
    'autoload.php';

    use 
    Facebook\FacebookRequest;
    use 
    Facebook\GraphObject;
    use 
    Facebook\FacebookRequestException;
    use 
    Facebook\FacebookSession;

    FacebookSession::setDefaultApplication('ID''Secret');

    // If you already have a valid access token:
    $session = new FacebookSession('accesstokken');

    // If you're making app-level requests:
    $session FacebookSession::newAppSession();

    // To validate the session:
    try {
      
    $session->validate();
    } catch (
    FacebookRequestException $ex) {
      
    // Session not valid, Graph API returned an exception with the reason.
      
    echo $ex->getMessage();
    } catch (\
    Exception $ex) {
      
    // Graph API returned info, but it may mismatch the current app or have expired.
      
    echo $ex->getMessage();
    }
    print_r($session); 
    Die Session Variable hat auch einen Accesstokken

    Nur wenn ich dann diesen Script Ausführe:

    PHP-Code:
    if($session) {

      try {

        
    // Upload to a user's profile. The photo will be in the
        // first album in the profile. You can also upload to
        // a specific album by using /ALBUM_ID as the path     
        
    $response = (new FacebookRequest(
          
    $session'POST''/me/photos', array(
            
    'source' => 'B/Koala.jpg',
            
    'message' => 'User provided message'
          
    )
        ))->
    execute()->getGraphObject();

        
    // If you're not using PHP 5.5 or later, change the file reference to:
        // 'source' => '@/path/to/file.name'

        
    echo "Posted with id: " $response->getProperty('id');

      } catch(
    FacebookRequestException $e) {

        echo 
    "Exception occured, code: " $e->getCode();
        echo 
    " with message: " $e->getMessage();

      }   


    erhalte ich diese Fehermeldung:

    Exception occured, code: 2500 with message: An active access token must be used to query information about the current user.

    Wo ist dass Problem?
Lädt...
X