1

I'm using Symfony 2.1 for a project & I'm using FOSFacebook bundle integrated with FOSUser bundle. when the user logs into my application no information is retrieved! i mean this line goes in exception :

namespace Acmes\UserBundle\Security\User\Provider;
class FacebookProvider implements UserProviderInterface {
//...
public function loadUserByUsername($username) {
 //...
 try {
       $fbdata = $this->facebook->api('/me');
   } catch (FacebookApiException $e) {
       $fbdata = null;
     }
 //...

} } when the user logs in, the button change to 'logout' but i get the error :

"The user is not authenticated on facebook"

which means that $fbdata is null & no info has returned back from facebook application.

any solution? thanks!:)

parisssss
  • 803
  • 16
  • 36
  • have you read the exception message ? maybe you misconfigured your facebook app – julien rollin Jan 31 '13 at 12:15
  • @JulienRollin,thanks for your answer,I think that I've checked every thing, but to ensure,is there any documentation which says how to config facebook application for using in this way? – parisssss Feb 01 '13 at 11:05
  • have you put the twig helper "facebook_initialize" in your layout/template ? Are you connected to facebook in an another tab ? Facebook php sdk uses a session cookie to know if you are connected – julien rollin Feb 01 '13 at 11:55
  • yes!and as i said the login button changes to logout button + after that user is authenticated in facebook in other tabs.. :( – parisssss Feb 02 '13 at 15:44
  • ok...so, check your app configuration in facebook (sandbox? allowed domain ?), remove all your cookies, and maybe remove access to your app in your facebook app pages ( "page settings" > tab "application") ? As it, you will retest the whole auth process :) – julien rollin Feb 02 '13 at 16:07
  • should the sandbox mode be enable?any way it doesn't change.. :( thanks for your answers!:) – parisssss Feb 03 '13 at 19:10
  • i enabled the sandbox mode(but it can't be enabled for ever of-course) and the user is authenticated by his facebook id but not integrated in database! – parisssss Feb 06 '13 at 06:21
  • the steps are: retrieve facebookid, check if user exists whith this id or create it, add/update facebook infos you need, thats it in 'loadUserByUsername' – julien rollin Feb 06 '13 at 12:36
  • i have dumped the FacebookApiException,like this: `var_dump($e);` and the result was : `'message' => string 'couldn't connect to host' (length=24) 'type' => string 'CurlException' (length=13)` – parisssss Feb 07 '13 at 13:33
  • are you on shared host ? it seems a curl config limitation – julien rollin Feb 07 '13 at 13:48
  • now i'm testing my application on local (using WAMP) – parisssss Feb 09 '13 at 12:09
  • the problem fixed.it was my vpn problem... how can i set this question as fixed?delete it? – parisssss Feb 14 '13 at 11:42
  • i would at least close it, but you should delete it, because you did not expose you misconfiguration – julien rollin Feb 14 '13 at 12:31

1 Answers1

0

I faced the same problem as yours. Something must go wrong during your installation process of fosuserbundle and fosfacebook bundle. Double check your settings with the following tutorial. https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/index.md

Toby D
  • 1,465
  • 1
  • 19
  • 31