title: Firebase JS - getToken() does not return a token
body: <p>I have the following code, based on <a href="https://firebase.google.com/docs/cloud-messaging/js/client" rel="noreferrer">Google's Documentation</a>:</p>
  
  <pre><code>var config = {
      apiKey: "XX",
      authDomain: "XX",
      databaseURL: "XX",
      storageBucket: "XX",
      messagingSenderId: "XX"
  };
  firebase.initializeApp(config);
  
  const messaging = firebase.messaging();
  
  messaging.requestPermission()
  .then(function() {
      console.log('Notification permission granted.');
      messaging.getToken()
      .then(function(currentToken) {
          if (currentToken) {
              console.log(currentToken);
          } else {
              console.log('No Instance ID token available. Request permission to generate one.');
          }
      })
      .catch(function(err) {
          console.log('An error occurred while retrieving token. ', err);
      });
  })
  .catch(function(err) {
      console.log('Unable to get permission to notify. ', err);
  });
  </code></pre>
  
  <p>Strangely enough, the <code>then</code> function of <code>messaging.getToken()</code> is never called. The console does display <code>Notification permission granted.</code>, but after that, it stays quiet (i.e. I don't get any errors either).</p>
  
  <p>Am I doing something wrong?</p>
  
  <p><strong>EDIT:</strong> It should be noted that I'm trying to implement this in a Chrome extension.</p>