<script type="module">
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.13.2/firebase-app.js";
import { getMessaging, getToken } from "https://www.gstatic.com/firebasejs/10.13.2/firebase-messaging.js";

const firebaseConfig = {
 apiKey:"APIKEY",
 authDomain:"PROJECT.firebaseapp.com",
 projectId:"PROJECT",
 messagingSenderId:"XXXX",
 appId:"XXXX"
};

const app = initializeApp(firebaseConfig);
const messaging = getMessaging(app);

Notification.requestPermission().then(async permission=>{
 if(permission==="granted"){

   const token = await getToken(messaging,{
      vapidKey:"VAPID_KEY_KAMU"
   });

   console.log("TOKEN:",token);

   fetch("save_token.php",{
     method:"POST",
     body:new URLSearchParams({token})
   });
 }
});
</script>