Receiving the same token for different users when using firebase messaging

后端 未结 3 1086
逝去的感伤
逝去的感伤 2020-12-17 18:57

I use the code below to obtain a token from firebase :

const messaging = firebase.messaging();

messaging.requestPermission()
  .then(() =>{
    return fi         


        
3条回答
  •  死守一世寂寞
    2020-12-17 19:36

    Another possible solution to the problem is to add a field called userId in your data that you send as a notification. And at client side, only show notification if the userId == FirebaseAuth.user.id or similar in case you are not using FirebaseAuth.

提交回复
热议问题