Note that there are some explanatory texts on larger screens.

plurals
  1. POfacebook php sdk $this->getUser always returning 0
    primarykey
    data
    text
    <p>I have searched a lot for this question and found no particular solution for this question.I have seen many examples and so-called solutions but none of them have worked. On top of that I am doing this watching a video by phpacademy and typing exactly as the video.</p> <p>Before anyone mark this as a duplicate my only question is </p> <p>Is this because I am testing this in local machine? Because the only difference between my setting and the video is that the tutorial is hosted live and I am testing this in my local machine.</p> <p>If this is the case?How can I test PHP facebook SDK in my local machine?</p> <p>Here is my complete code this is my main controller </p> <pre><code>if (!defined('BASEPATH')) exit('No direct script access allowed'); class Fbapp extends MX_Controller { function __construct() { $this-&gt;load-&gt;library('fbconnect'); parent::__construct(); } function index() { echo "&lt;a href='" . base_url() . "fbapp/gotofb'&gt;Go To Facebook&lt;/a&gt;"; } function gotofb(){ $data = array( 'redirect_uri' =&gt; base_url() . "fbapp/redirected", 'scope' =&gt; "email,photo_upload" ); $url = $this-&gt;fbconnect-&gt;getLoginUrl($data); redirect($url); } function redirected(){ $user_id= $this-&gt;fbconnect-&gt;getUser(); echo $user_id; } } </code></pre> <p>This is my library file that I have named "fbconnect.php",included sdk files inside libraries and incuded in library and I have created a facebook.php inside config which stores appId and secret which i have loaded as $config.</p> <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); require_once(APPPATH . 'libraries/facebook/src/facebook.php'); class Fbconnect extends Facebook{ public $user = null; function __construct() { $ci =&amp; get_instance(); $ci-&gt;load-&gt;config("facebook", true); $config = $ci-&gt;config-&gt;item('facebook'); parent::__construct($config); } } </code></pre> <p>Steps: 1.i access my url .I click on the link. 2.it get me to the login page of facebook. I login. 3. it redirects me to the redirect uri and prints 0.</p> <p>Note:I am developing in codeigniter. Thanks in advance. Any help is super appreciated!!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload