Facebook PHP SDK - Graph returned an error: Invalid OAuth access token

前端 未结 2 2044
醉酒成梦
醉酒成梦 2020-12-11 04:37

Here is my code:

login.php:

 \'\',
  \'         


        
相关标签:
2条回答
  • 2020-12-11 04:47

    You didn't retrieve the valid access token.

    Change:

    $fb = new Facebook\Facebook([
      'app_id' => '',
      'app_secret' => '',
      'default_graph_version' => 'v2.2',
      ]);
    
    
    $helper = $fb->getRedirectLoginHelper();  
    
    try {  
      $accessToken = $helper->getAccessToken();  
      $response = $fb->get('/me?fields=id,name', $accessToken );
      ....
    } catch(Facebook\Exceptions\FacebookResponseException $e) { 
    ...
    

    Have a look here

    0 讨论(0)
  • 2020-12-11 05:07

    Error:
    Facebook SDK returned an error: Access token was not returned from Graph.

    Only add Your call back URL in

    $helper = $fb->getRedirectLoginHelper();

    to

    $helper = $fb->getRedirectLoginHelper('http://www.sportsector.bg/login-callback.php');

    it's Working form me ..

    0 讨论(0)
提交回复
热议问题