Reputation: 2316
After hours of Googling and research, I cant find out how to get the facebook user access token. I have an app which wants to access my posts. I have used facebook php sdk
and Graph Api call
, but in both the cases what I got is an app access token. The error when I used this token to get the posts is
Uncaught OAuthException: A user access token is required to request this resource.
I found it needs user access token with the permissions. Eventually I got a way to get the user access token. I have used the Graph API Explorer
to get a shot lived user access token and then I have extended it using expires
parameter and my app is working well. I am still searching for a way to get the user access token by Graph API
call or PHP SDK
.
I want to get the user access token for my own Facebook account. Please help me.
Thanks
Upvotes: 0
Views: 704
Reputation: 19995
If you follow the example given by the PHP SDK https://raw.github.com/facebook/facebook-php-sdk/master/examples/example.php then you should be able to understand how to login.
Also see the Getting Started version of the PHP SDK in developers.facebook.com https://developers.facebook.com/docs/php/gettingstarted/
The gist of it is that the user logs in via the link provided from the getLoginUrl()
method after which the user will go through an authentication flow similar to the flow you experienced when requesting an access token from the Graph API Explorer
Upvotes: 1