简体   繁体   中英

FCM - "messaging/registration-token-not-registered" - but the client is still using the token?

When sending a multicast message to FCM...

        const message = {
            notification: {
                title: messageTitle,
                body: messageBody,
            },
            tokens: tokenArray,
        }

        getMessaging().sendMulticast(message)

I'm receiving this error.

messaging/registration-token-not-registered - Requested entity was not found

According to this post , I should then remove the token.

Here's what I'm confused about though. When I run getToken() on my client device, it's still showing this same token.

getToken(messaging, { vapidKey: "MY_VAPID_KEY"}).then(token => console.log(token))

Is there like a registration step that I'm missing? I don't understand why the client is using this as the current token but FCM thinks it's unregistered.

So my solution was I reset the browser cache and notification permissions. My browser then generated a new token which is working.

Kind of strange though is on the first call of getToken() after clearing and refreshing, it sent a request to delete the token after failing a check with isTokenValid() , and then the delete itself failed so my token remained registered and is now working. No idea what's going on there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM