简体   繁体   English

在服务器端使用Facebook访问令牌

[英]Using facebook access token on the Server side

I am working on the project which has a mobile front end and php server backend. 我正在从事具有移动前端和php服务器后端的项目。 It Implements a facebook login on the the front end getting the required tokens. 它在前端实现Facebook登录,以获取所需的令牌。 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.? 现在,将此令牌发送到php后端,以便可以使用此令牌获取用户信息和朋友列表。.我该如何在Codeigniter中将其与fb-php sdk一起使用?

You could pass it over using a cookie. 您可以使用Cookie将其传递过来。 I have used the facebook api a few times but never tried this. 我已经使用了Facebook API几次,但从未尝试过。

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. 使用PHP sdk登录用户会不会更容易,因为那样您就已经可以使用访问令牌了。

You can add fb-sdk as a thirdpaty library and after you initialize the object you can retrive the friend list like this 您可以将fb-sdk添加为Thirdpaty库,并且在初始化对象后可以像这样检索朋友列表

$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/ 检查此链接以了解如何获取应用程序访问令牌: http : //developers.facebook.com/docs/facebook-login/access-tokens/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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