Setting up Facebook Login on localhost

前端 未结 1 1351
长情又很酷
长情又很酷 2020-12-19 14:23

I\'ve been following the steps outlined here to create a Facebook App Login: http://developers.facebook.com/docs/howtos/login/server-side-login/

And am on Step 3. I

相关标签:
1条回答
  • 2020-12-19 14:31

    this code worked for me. double check your facebook app id and my site url is set to http:// localhost:8052/ dont really need to set domain name for login thanks

    http://gamma.owlweb.com.ua/index.php/?route=account/register/fb

    <?php
    
    $app_id = "xxx";    $app_secret = "xxx"; 
    $my_url ="http://localhost:3080/abc.php";
    
    session_start();
    
    $code = '';    
    
    if(!isset($_REQUEST["code"])) {
      $_SESSION['state'] = md5(uniqid(rand(), TRUE)); // CSRF protection
      $dialog_url = 
        "https://www.facebook.com/dialog/oauth?client_id=".$app_id
        ."&redirect_uri=".urlencode($my_url)
        ."&state=".$_SESSION['state'];
    
      echo $my_url.'<br/>';
      echo $dialog_url.'<br/>';
      echo("<script> top.location.href='" . $dialog_url . "'</script>");
    } 
    ?>
    
    0 讨论(0)
提交回复
热议问题