Asghar
Asghar

Reputation: 2346

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

Upvotes: 0

Views: 1663

Answers (2)

Jesus Arriaga
Jesus Arriaga

Reputation: 1

Change your graph call's api ('/me') by ('/[number or name id]')

Upvotes: 0

David Cheung
David Cheung

Reputation: 858

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?

Upvotes: 1

Related Questions