PHP SDK 3.1.1 getUser() sometimes return 0

前端 未结 5 923
日久生厌
日久生厌 2020-12-17 21:32

This is driving me crazy >=(

$facebook->getUser() works well sometimes, but sometimes returns 0

Here is my code: require \'fbapi/facebook.php\';
$

5条回答
  •  无人及你
    2020-12-17 22:05

    So i was struggling with the same problem, getUser() always returned 0. Did not make any sense at all. NginX error logs was showing the following error 'CSRF state token does not match one provided'. Then I started debugging the sdk and narrowed it down to getAccessTokenFromCode() not able to get the right accesstoken from the Facebook servers, something to do with SSL certificates.

    The solution at the below mentioned link solved the problem for me.

    https://github.com/facebook/php-sdk/issues/272

    Also you may need to copy the 'fb_ca_chain_bundle.crt' file bundled with the sdk to folder where your facebook class file is located. i did.

    I hope this makes sense.

提交回复
热议问题