简体   繁体   中英

Facebook PHP SDK 3 issue in access_token

I am using facebook PHP SDK. After the user allows my application, facebook redirects to may web page. Following is the URL

http://Mydowmain.com/facebook.htm?state=d96afbb9ea550fg81c287b7822cee0af1&code=AQDtl7Rd7qgCp6S_dXwOCxxfXo1dEh75ZJqrCINMawCUzxOYs9JnpmWKMoYTgjuNhQx2nk8pleCdvGqSt39F2pHKMHt3aNxwqoIah2oshPKKC0MnWycPSU0yLAKMYVQV2g3jRQdEMf2dWTVUrk_ammSpGaYbfFQ3GeccZ1vGqfVazsaQ_1Lxz7GjITlqgCxrOlc#_=_

I need to fetch the access_token Following is the code

if($_GET['code'] != '')
        {

$access_token = $facebook->getAccessToken();

When i try to use this $access_token to get the user details.

$user_profile   =   'https://graph.facebook.com/me/?access_token='.$access_token;

It gives the following error

{"error":{"message":"An active access token must be used to query information about the current user.","type":"OAuthException","code":2500}}

}

I dnt what i am doing wrong, it was working with SDK 2 but not working with SDK3

$access_token = $facebook->getAccessToken();

this Call Returns the following, in which fistpart before "|" is App ID and After "|" is App Secret..

187997367916887|9d87d7a2d26485fd926a000b0c3b2f87

Check this link out, scroll down to the answer with the following in bold: "When using your Facebook Application's token", hope it helps.

Facebook access_token invalid?

将图形调用的api('/ me')更改为('/ [数字或名称ID]')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM