title: Twilio push notification for programmable chat failed
body: <p>I'm working on an app that uses the Twilio Programmable Chat API using node.js and angular js. I have enabled push configuration inside twilio chat instance. And i have created push credentilals in twilio with the firebase secret key. After this i have fetched the twilio token using chatGrant with the twilio credential sid. I have included the firebase.js file and initialised firebase. After this I got permission from user to show notification. This all works fine. But when I am trying to get device token to register with chatclientinstance, it is getting failed. 
  Here is my code which initialising the firebase and taking permission, </p>
  
  <pre><code> var config = {
        apiKey: "my_key",
        authDomain: "example.firebaseapp.com",
        databaseURL: "https://example.firebaseio.com",
        projectId: "example",
        storageBucket: "example.appspot.com",
        messagingSenderId: "861813283864"
      };
      if (firebase) {
        firebase.initializeApp(config);
        console.log("firbase initialized.");
      }
  
      if (firebase &amp;&amp; firebase.messaging()) {
        // requesting permission to use push notifications
        firebase.messaging().requestPermission().then(() =&gt; {
          // getting FCM token
          console.log("got permission for showing notification.");
          firebase.messaging().getToken().then((fcmToken) =&gt; {
            // continue with Step 7 here 
            console.log("got fcm token.",fcmToken);
            // ... 
            // ... 
          }).catch((err) =&gt; {
            // can't get token
            console.log("error in getting token for notification.",err);
          });
        }).catch((err) =&gt; {
          // can't request permission or permission hasn't been granted to the web app by the user
          console.log("error in getting permission for notification.",err);
        });
      } else {
        // no Firebase library imported or Firebase library wasn't correctly initialized
        console.log("no Firebase library imported or Firebase library wasn't correctly initialized");
      }
  
  }
  </code></pre>
  
  <p>I got this in console,</p>
  
  <pre><code>firbase initialized.
  got permission for showing notification.
  The script has an unsupported MIME type ('text/html').
  Failed to load resource: net::ERR_INSECURE_RESPONSE                 firebase-messaging-sw.js 
  error in getting token for notification. 
  e {code: "messaging/failed-serviceworker-registration", message: "Messaging: We are unable to register the default s…). (messaging/failed-serviceworker-registration).", browserErrorMessage: "Failed to register a ServiceWorker: The script has an unsupported MIME type ('text/html').", stack: "FirebaseError: Messaging: We are unable to registe…o/polyfills.bundle.js:3152:35)↵    at &lt;anonymous&gt;"}
  </code></pre>
  
  <p>I have did everything as twilio docs says at <a href="https://www.twilio.com/docs/api/chat/guides/push-notifications-web" rel="nofollow noreferrer">PUSH NOTIFICATIONS ON WEB</a></p>
  
  <p>But I did not added "firebase-messaging-sw.js" in my server. Is there any need to add this js file or twilio will automatically create and initialise it? </p>
  
  <p>Please find me a solution for this. Thanks in advance.</p>