dongluo1853 2012-01-18 16:56
浏览 44
已采纳

Facebook JS SDK和PHP SDK没有刷新?

I currently have the facebook js sdk to login to the site and then I want to use the PHP sdk for everything else. How can I pass the accessToken to the PHP SDK to allow me to do this? I want to pass it to a PHP script at a different url, so for example I login at /login/ and then open up a modal box to /facebook/?accessToken=gfdhjsfghjkfgdh or what ever.

  • 写回答

1条回答 默认 最新

  • draj30958 2012-01-18 18:02
    关注

    http://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/

    Please check this link.

    A sample code may look like this,

    FB.getLoginStatus(function(response) {
      if (response.status === 'connected') {
        //got the token
        var accessToken = response.authResponse.accessToken;
        //send it to php via _GET
        window.location = "/facebook/?accessToken=" + accessToken;
      } else if (response.status === 'not_authorized') {
        // the user is logged in to Facebook, 
        //but not connected to the app
      } else {
        // the user isn't even logged in to Facebook.
      }
     });
    

    You can get the accesstoken then send it to php.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作