title: How to fix "Refused to load the script 'https://connect.facebook.net/en_US/sdk.js' because it violates the following Content Security Policy "?
body: <p>I am trying to add Facebook login SDK in chrome extension but getting following error:</p>
  
  <p>"Refused to load the script '<a href="https://connect.facebook.net/en_US/sdk.js" rel="nofollow noreferrer">https://connect.facebook.net/en_US/sdk.js</a>' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval' <a href="https://www.google-analytics.com" rel="nofollow noreferrer">https://www.google-analytics.com</a>". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback".</p>
  
  <p>I added permissions and content security policy in manifest but error did not resolve.
  here is my home.js</p>
  
  <pre><code>$(".account-with-facebook").click(function(){
  alert("fb login btn clicked");
  window.fbAsyncInit = function() {
      // FB JavaScript SDK configuration and setup
      FB.init({
        appId      : '2314780002148700', // FB App ID
        cookie     : true,  // enable cookies to allow the server to access the session
        xfbml      : true,  // parse social plugins on this page
        version    : 'v3.2' 
      });
  
      // Check whether the user already logged in
      FB.getLoginStatus(function(response) {
          if (response.status === 'connected') {
              //display user data
              getFbUserData();
          }
      });
  };
  
  // Load the JavaScript SDK asynchronously
  (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'));
  
  // Facebook login with JavaScript SDK
  function fbLogin() {
      FB.login(function (response) {
          if (response.authResponse) {
              // Get and display the user profile data
              getFbUserData();
          } else {
              console.log('User cancelled login or did not fully authorize.');
          }
      }, {scope: 'email'});
  }
  
  // Fetch the user profile data from facebook
  function getFbUserData(){
      FB.api('/me', {locale: 'en_US', fields: 
   'id,first_name,last_name,email,link,gender,locale,picture'},
      function (response) {
          console.log(response);
      });
   }
  
     // Logout from facebook
     function fbLogout() {
        FB.logout(function() {
      });
    }
  });      
  </code></pre>
  
  <p>Manifest.json</p>
  
  <pre><code>{
  "background": {
      "scripts": [
          "js/lib/ga.js",
          "js/lib/jquery.min.js",
          "js/lib/md5.min.js",
          "js/lib/redirect-path.js",
          "js/lib/js.local-session.js",
          "js/lib/js.cookie.js",
          "js/lib/js.storage.js",
          "js/lib/moment.js",
          "js/lib/parser.js",
          "js/ext/background.js"
      ]
  },
  "browser_action": {
      "default_icon": {
          "38": "icon/default-38.png"
      },
      "default_title": " Cupon Up - Automatic Coupon Finder"
      //"default_popup": "page/store-popup.html"
  },
  "content_scripts": [
      {
          "all_frames": false,
          "css": ["css/inject-cb-button.css"],
          "js": [
              "js/lib/jquery.min.js",
              "js/lib/md5.min.js",
              "js/lib/jquery.sendkeys.js",
              "js/lib/promise.js",
              "js/lib/js.local-session.js",
              "js/lib/js.cookie.js",
              "js/lib/js.storage.js",
              "js/lib/lang.js",
              "js/lib/i18n.translator.js",
              "js/ext/content.js"
          ],
          "matches": ["http://*/*", "https://*/*"],
          "run_at": "document_end"
      }
  ],
  "content_security_policy": "script-src 'self' https://connect.facebook.net/en_US/sdk.js; object-src 'self'",
  "content_security_policy": "script-src 'self' 'unsafe-eval' https://www.google-analytics.com; object-src 'self'",
  "description": "Find and Test coupon  on Affiliated sites",
  "icons": {
      "128": "icon/logo-128.png",
      "16": "icon/logo-16.png",
      "48": "icon/logo-48.png"
  },
  //"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgSZyTE0bgqvNL0gZgT0s+DsSDrGO0iskmQR7A/Ayn00oal8Frp6g9kVnh4P+7ZlYqNpF/ggXpprBMLQQAlVo57XRB4rJbHEJOSr5z1qf90NT3zdiNNQdJC6tOTLZMZnR13LA2677Kl7K/u2vR/3r1FcvkeuHC42u2I89h5Vz1s80e9Hc98fsXM0gtiCz1QKW/mf0d4YcFgyLTdvm5106WXEH/maqRKlFuo+w0P33qnRflzX7y2ca4lMYUr5uc2/M9FE1EnhoKfu4c37u/h4773welAafdMWQaI7u/lx+reaQCSPxX6mYIhx4pc7u7RS7hVAQMAWJlRHiRtFxMfSb7QIDAQAB",
  "manifest_version": 2,
  "name": "Cupon Up",
  "permissions": [
      "cookies",
      "tabs",
      "storage",
      "unlimitedStorage",
      "webRequest",
      "webRequestBlocking",
      "http://*/*",
      "https://*/*",
      "https://connect.facebook.net/en_US/sdk.js"
  ],
  //"update_url": "https://clients2.google.com/service/update2/crx",
  "version": "1.0",
  "default_locale": "en_US",
  "web_accessible_resources": ["img/*", "css/*", "page/*"]
  </code></pre>
  
  <p>}</p>