When attempting to acquire a token from firebase, I employ the code snippet provided below:
const messaging = firebase.messaging();
messaging.requestPermission()
.then(() =>{
return firebase.messaging().getToken();
}).then(token => {
saveTokentoServer(user.uid, token);
})
However, a recurring issue arises where I am receiving identical tokens for different users. Consequently, I am unable to send targeted messages.
Is there anyone who can provide guidance on obtaining distinct tokens for individual users?
After spending two days searching for solutions, I am perplexed as to why my web application is not generating unique tokens.