php - Direct access after authentication insteed iframe access -
when user authorize app, redirected site , not facebook app in iframe. there way stay in facebook ? code :
require './src/facebook.php'; $config = array(); $config['appid'] = 'xxxxx'; $config['secret'] = 'xxxxx'; $config['fileupload'] = false; // optional $facebook = new facebook($config); $user = $facebook->getuser(); if ($user) { try { // proceed knowing have logged in user who's authenticated. $user_profile = $facebook->api('/me'); } catch (facebookapiexception $e) { error_log($e); $user = null; } } // login or logout url needed depending on current user state. if ($user) { echo "blah"; } else { $params = array( 'scope' => 'read_stream, friends_likes', 'redirect_uri' => 'https://xxxxx' ); $loginurl = $facebook->getloginurl($params); echo("<script> top.location.href='" . $loginurl . "'</script>"); } ?>
try putting app's url (http://apps.facebook.com/your_app_namespace) in redirect_uri param. should fix issue facing.
Comments
Post a Comment