CodeIgniter Forums
LogIn with Facebook - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: LogIn with Facebook (/showthread.php?tid=68565)



LogIn with Facebook - Knutsford - 07-28-2017

I am trying to get LogIn with Facebook to work but it isn't getting an Access Token.

I have pinned it down to this function in FacebookRedirectLoginHelper.php



 
Code:
public function getAccessToken($redirectUrl = null)
    {
     
        if (!$code = $this->getCode()) {
            return null;
        }


        $this->validateCsrf();

        $redirectUrl = $redirectUrl ?: $this->urlDetectionHandler->getCurrentUrl();
        // At minimum we need to remove the state param
        $redirectUrl = FacebookUrlManipulator::removeParamsFromUrl($redirectUrl, ['state']);

        return $this->oAuth2Client->getAccessTokenFromCode($code, $redirectUrl);
    }

It is  returning from
Code:
if (!$code = $this->getCode()) {
   return null;
}

with null

The code has me confused - where should getCode get the access code from to start with?


Thanks


RE: LogIn with Facebook - InsiteFX - 07-28-2017

Access Tokens


RE: LogIn with Facebook - Knutsford - 07-28-2017

(07-28-2017, 09:17 AM)InsiteFX Wrote: Access Tokens
I was using the code from https://www.codexworld.com/facebook-login-codeigniter/ and when I traced it through using echos it didn't authenticate as there was no Access Token set. I have no idea why or where it is supposed to get it from. I would have thought there was a  call to facebook but I can't see one


RE: LogIn with Facebook - Knutsford - 07-28-2017

(07-28-2017, 09:39 AM)Knutsford Wrote:
(07-28-2017, 09:17 AM)InsiteFX Wrote: Access Tokens
I was using the code from https://www.codexworld.com/facebook-login-codeigniter/ and when I traced it through using echos it didn't authenticate as there was no Access Token set. I have no idea why or where it is supposed to get it from. I would have thought there was a  call to facebook but I can't see one

In

FacebookRedirectLoginHelper.php


there is



Code:
 protected function getCode()
    {
        return $this->getInput('code');
    }




and




Code:
 private function getInput($key)
    {
        return isset($_GET[$key]) ? $_GET[$key] : null;
    }



What is suppose to doing the GET to get the value I have no idea. I can't find anything. Does anyone? If not can someone please point me in the direction of something that actually does work please.


Thanks