php - Facebook SDK v4 it does not redirect -
hello working sdk v4 facebook , when login not redirect generates code ( in low image link when log ) can help ?
image
code
<?php session_start(); // define root directoy define( 'root', dirname( __file__ ) . '/' ); // autoload required files require_once( root . 'autoload.php' ); utilize facebook\facebooksession; utilize facebook\facebookredirectloginhelper; utilize facebook\facebookrequest; utilize facebook\facebooksdkexception; //dados api $app_id = '346646635512123'; $app_secret = '21h3vj12i312b3hj123'; $redirect_uri = 'http://localhost:8888/facebook/'; // permissoes $permissions = array('email', 'user_location', 'user_birthday', 'manage_pages', 'publish_actions', 'user_photos'); facebooksession::setdefaultapplication($app_id, $app_secret); $helper = new facebookredirectloginhelper($redirect_uri); seek { $session = $helper->getsessionfromredirect(); } catch(exception $ex) { // when validation fails or other local issues } if (isset( $session)) { echo'estou ligado'; } else { echo "<a href = " . $helper -> getloginurl() . ">login facebook</a>"; }
?>
you don´t have redirection in code, why. need click on login link authorization screen. think misunderstood "facebookredirectloginhelper", usefuly after redirection authorization screen.
i suggest using js sdk authorization though. much easier handle, no redirection needed, no php needed, ...
php facebook facebook-graph-api
No comments:
Post a Comment