doujiu8479 2015-05-04 05:05
浏览 41

从facebook帐户中删除canvas facebook app,现在又要添加它(php sdk)

I am developing a facebook canvas app with the latest php sdk (v4 at time of writing). Previously I used the JS SDK with login callbacks to authenticate, but I'm now using the PHP SDK (don't want to use JS) and have removed the app from my test account. I want to add it again, but this time using only the PHP SDK. I have the following code in my index.php

require '../vendor/autoload.php';

use Facebook\FacebookSession;
use Facebook\FacebookJavaScriptLoginHelper;
use Facebook\FacebookRequest;
use Facebook\GraphUser;
use Facebook\FacebookRequestException;
use Facebook\FacebookCanvasLoginHelper;


FacebookSession::setDefaultApplication('123123132', 'cafebabe');

// Add `use Facebook\FacebookCanvasLoginHelper;` to top of file
$helper = new FacebookCanvasLoginHelper();
try {
  $session = $helper->getSession();
  if ($session) {
  echo 'Login';
} else {

  echo 'Not logged in';
}
} catch(FacebookRequestException $ex) {
  // When Facebook returns an error
} catch(\Exception $ex) {
  // When validation fails or other local issues
}

When I access my app's page I just get "Not logged in", meaning session . Am I meant to do something else? I believe I need to approve the App's use (like what permission I wish to give the app, like I did with JS, at some point in time?). I've been using the official facebook documentation along with searching for other tutorials, and haven't found a way to do it outside of using JavaScript.

Thanks

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 下图接收小电路,谁知道原理
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度