Lately I had a task to implement FCM (Firebase Cloud Messaging) to a vue application I am working on, and I've found out that there are few guides ...
For further actions, you may consider blocking this person and/or reporting abuse
Thanks a lot!
I could be able to complete all the steps successfully following this article.
I am getting an error
Are you trying to install firebase npm package? If you do, then what is the version ?
Hi,
I'm getting this too - on build.
Do you remember how you fixed it - assuming you did :)
Thanks
This is due to a firebase npm package version 9 bug.
Solution: steps-
How can i get access to the generated "currentToken" in vue ?
Hey,
You can call the
getToken()
function again - you will get the registered token.Hi Fima!
How to post currentToken to some API by axios?
I cannot use import statement outside vue module!
Hey,
I guess you are trying to send the request from the service worker and not from the app itself, as far as I know you can't access
axios
inside service workers - but you can usefetch
instead:Hello,
Is it necessary to put firebase.js in a specific folder on step 3?
Can you give me the advice to tell me should put this file (firebase.js) in which folder?
Hey, you can place the firebase.js file where-ever you want, you can even place the content of the file inside main.js and delete firebase.js.
How to subscribe to specific topics with this approach bro? Thanks in advance.
it is necessary to import something to use messaging.getToken in Step 4 ?
Yes, you need to import firebaseMessaging from the src/firebase.js file. Then you can use it like firebaseMessaging.getToken()
i am getting this error when i get vapidKey
i used step 3
Step3, firebase.js code throw an error like this, why?