$facebook->getUser() keep returning null after facebook login redirection

mwd

New Member
I am getting an issue while trying to auth user through the graph API with the official php sdk.Look simple as hell but I can not get it to work and getUser() keep returning null.Here is my code reduced in the most simple form:\[code\]$facebook = new Facebook(array( 'appId' => 'ID', 'secret' => 'SECRET', 'cookie' => true )); $user = $facebook->getUser(); if (!$user): $params = array('scope' => 'email','redirect_uri' => 'http://myredirecturi.com'); ?> <a href="http://stackoverflow.com/questions/12536317/<? echo $facebook->getLoginUrl($params); ?>">Login</a> <? else: $params = array( 'next' => 'http://anotherrecirecturi.com' ); ?> <a href="http://stackoverflow.com/questions/12536317/<? echo $facebook->getLogoutUrl($params); ?>">Logout</a> <? endif; ?>\[/code\]So when I click the login button I go to facebook and them I arrived on the redirect url like it should be.I also have GET data: "code" and "state" so it is looking good, however I don't have a "signed_request" value.Finally, $facebook->getUser() keep returning null.What is wrong here ?-Is the facebook object well initialized ? (should the 'cookie' setting be set to true ?)-The redirect_uri is also not an https uri. Does it matter ?-Should I look for something in the facebook app settings ?Thanks !
 
Top