title: Facebook log in works only after deleting cookies:Given URL is not allowed by the Application configuration Facebook application error
body: <p>I have been using facebook login option on my website for about 3 months now. Everything worked fine. But today I am getting the error:</p>
  
  <blockquote>
    <p>Given URL is not allowed by the Application configuration.: One or
    more of the given URLs is not allowed by the App's settings. It must
    match the Website URL or Canvas URL, or the domain must be a subdomain
    of one of the App's domains.</p>
  </blockquote>
  
  <p><strong>This happens when the user is already logged into facebook.</strong> If the user needs to login the sign in works fine as before. Alternatively clearing out the cookies also works, makes the facebook log in work as before. </p>
  
  <p>This happened by itself without any changes to app settings on facebook. I have gone through the other questions on SO and can't seem to figure this out. Any ideas?</p>
  
  <pre><code>$(function() {
    $('body').prepend('&lt;div id="fb-root"&gt;&lt;/div&gt;');
    return $.ajax({
      url: "" + window.location.protocol + "//connect.facebook.net/en_US/all.js",
      dataType: 'script',
      cache: true
    });
  });
  
  window.fbAsyncInit = function() {
    FB.init({
      appId: '123456789098765434',
      cookie: true
    });
    $('#sign_in').click(function(e) {
      e.preventDefault();
      return FB.login((function(response) {
        if (response.authResponse) {
          return window.location = '/auth/facebook/callback';
        }
      }), {
        scope: 'email,user_likes'
      });
    });
    return $('#sign_out').click(function(e) {
      FB.getLoginStatus(response);
      return true;
    });
  };
  </code></pre>