简体   繁体   中英

Using facebook access token on the Server side

I am working on the project which has a mobile front end and php server backend. It Implements a facebook login on the the front end getting the required tokens. Now this token is sent to the php backend so that this token can be used to get the user info and friends lists.. how can i go about using this with the fb-php sdk in Codeigniter.?

You could pass it over using a cookie. I have used the facebook api a few times but never tried this.

Would it not be easier to use the PHP sdk to log the user in because then you would already have the access token available.

You can add fb-sdk as a thirdpaty library and after you initialize the object you can retrive the friend list like this

$fb->api('/[userid]/friends?access_token=[access_token]');

if you have problems with users access token you can use applications access token too. Check this link to how to get the app access token : http://developers.facebook.com/docs/facebook-login/access-tokens/

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