This repository contains a simple starter kit for using Firebase Cloud Messaging in a Vue app.
-
Clone the repository:
git clone https://github.com/iamhosen/firebase-cloud-messaging-vue
-
Navigate to the project directory:
cd firebase-cloud-messaging-vue
-
Install dependencies
npm install
-
Add your firebase project config to public/firebase-messaging-sw.js and /App.vue
/* /public/firebase-messaging-sw.js */ firebase.initializeApp({ apiKey: "", authDomain: "", projectId: "", storageBucket: "", messagingSenderId: "", appId: "", }); /* /public/firebase-messaging-sw.js */ const firebaseConfig = { apiKey: "", authDomain: "", projectId: "", storageBucket: "", messagingSenderId: "", appId: "", };
-
Add firebase FCM token to /App.vue
getToken(messaging, { vapidKey: "", })
-
Start the development server
npm run dev
-
Open your browser and visit http://localhost:3000/ to view the app.
-
By clicking on 'Permission' button you will ask for permission. by allow it you will get the device token on console.
This Weather App is developed by Hossein Amirhosseini.
This project is licensed under the MIT License.