title: Facebook Login / Graph API - getting started on localhost and http (not https)
body: <p>I've been researching and going in circles for the past few hours. Help would be much appreciated. My setup:</p>
  
  <ul>
  <li>Mac OS </li>
  <li>Django 2.0.2 (I use <code>python manage.py runserver</code> to work on localhost)</li>
  <li>My app URL: <code>http://localhost:8000/</code>  </li>
  <li>Attempting to use Facebook Login / Facebook API to manage a page</li>
  </ul>
  
  <p>I am just trying to log in to set up an access token - following the <a href="https://developers.facebook.com/docs/javascript/quickstart" rel="nofollow noreferrer">Javascript SDK</a> which seems a straightforward path to logging in. However, on the console I get this error:</p>
  
  <pre><code>Insecure Login Blocked: You can't get an access token or log in to this app from an insecure page. Try re-loading the page as https://
  </code></pre>
  
  <p>This seems to be well documented but the <a href="https://stackoverflow.com/questions/14667180/setting-up-facebook-login-on-localhost">answers I am reading</a> seem old. As of now, the product "Facebook Login" has a setting called "Enforce HTTPS" which cannot be changed (it is a "Yes") for the app I just created and want to test. So obviously it makes sense that I cannot do this without a HTTPS domain, although some posts say otherwise. This brings me to researching on how to get a secure <code>https://localhost</code> setting but this seems complex, and I'm hoping there is something I missed so I can focus on learning the Facebook Graph API. </p>
  
  <p>My code is bare and just attempts to use the Javascript SDK to log in, and once I am past this I would use Python to manage it in a session. Feedback welcome.</p>
  
  <pre><code>&lt;body&gt;
  
      &lt;!-- Facebook SDK: https://developers.facebook.com/docs/javascript/quickstart --&gt;
      &lt;script&gt;
        window.fbAsyncInit = function() {
          FB.init({
            appId            : '**App ID here**',
            autoLogAppEvents : true,
            xfbml            : true,
            version          : 'v3.0',
            cookie           : true /* override setting */
          });
  
          /* testing login with alert */
              FB.getLoginStatus(function(response) {
                if (response.status === 'connected') {
                  alert('logged in');
                  console.log('Logged in.');
                }
                else {
                  alert('NOT logged in');
                  FB.login();
                }
              });
        };
  
        (function(d, s, id){
           var js, fjs = d.getElementsByTagName(s)[0];
           if (d.getElementById(id)) {return;}
           js = d.createElement(s); js.id = id;
           js.src = "https://connect.facebook.net/en_US/sdk.js";
           fjs.parentNode.insertBefore(js, fjs);
         }(document, 'script', 'facebook-jssdk'));
      &lt;/script&gt;
  </code></pre>
  
  <p>Also, to get a token in HTTP, should I actually do this manually, as Facebook describes? <a href="https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow" rel="nofollow noreferrer">https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow</a> - I'm attempting this next but I'd really like any expertise shared on this forum! Thank you.</p>