Facebook PHP SDK: getting “long-lived” access token now that “offline_access” is deprecated

前端 未结 4 1250
灰色年华
灰色年华 2021-01-31 05:44

BASIC PROBLEM: I want my app to be able to make calls to the Facebook graph api about authorized users even while the user is away.

For example, I want

4条回答
  •  太阳男子
    2021-01-31 06:25

    In the last Facebook PHP SDK 3.2.0 you have a new function setExtendedAccessToken() that you have to call before getAccessToken();

    Like this:

    $user = $facebook->getUser(); 
    $facebook->setExtendedAccessToken(); //long-live access_token 60 days
    $access_token = $facebook->getAccessToken();
    

提交回复
热议问题