firebase id doken世代被打破了
上下文
我正在使用Firebase消息传递进行角度Web应用程序。 我遵循了托特尔(Tutoriel)和文档,以成功地配置firebase(我想)。
一切都可以在客户端上生成Firebase ID令牌,然后使用它订阅一些主题,然后接收推送消息。
问题
,但是自2天以来,我的令牌似乎在Chrome浏览器上无效 。当我使用getToken()函数时(来自'firebase/messaging')时,它仍然是正确生成的,并在控制台中打印。
但是,当我尝试使用sisscribtopic(topicname)
'firebase-admin'时,我会收到以下错误每次
code: 'messaging/registration-token-not-registered',
message: 'The provided registration token is not registered. A previously valid registration token can be unregistered for a variety of reasons. See the error documentation for more details. Remove this registration token and stop using it to send messages.'
我了解错误所说的话,但是到目前为止,我无法删除令牌并使Firebase生成另一个。 我尝试了以下函数来删除令牌而没有成功的
getToken(getMessaging(), { vapidKey: environment.firebase.vapidKey }).then(
(token) => deleteToken(getMessaging())
);
FirebaseError: Messaging: A problem occurred while unsubscribing the user from FCM: FirebaseError: Messaging: A problem occurred while unsubscribing the user from FCM: Requested entity was not found. (messaging/token-unsubscribe-failed). (messaging/token-unsubscribe-failed)
我的配置和代码似乎正确,因为如果我在Firefox浏览器上运行我的应用程序,则一切正常,令牌是正确的
我该如何解决?有没有办法迫使火箱刷新客户令牌并产生另一个有效一个?
Context
I am making an Angular web application using firebase messaging.
I followed a tutoriel and the documentation to configure firebase successfully (I guess).
Everything was okay to generate a firebase id token on client and then use it to subscribe to some topics and then receive push message.
Issue
But since 2 days, my token seems to be invalid on Chrome browser. It is still generated correctly and printed in the console when I use getToken() function (from 'firebase/messaging').
But when I try to use it to subscribe to a topic on the server side (NestJS app) with subscribeToTopic(topicName)
from 'firebase-admin'
I get the following error everytime
code: 'messaging/registration-token-not-registered',
message: 'The provided registration token is not registered. A previously valid registration token can be unregistered for a variety of reasons. See the error documentation for more details. Remove this registration token and stop using it to send messages.'
I understand what the error says, but I am so far unabled to delete the token and make firebase generate another one.
I tryed the following function to delete the token without success
getToken(getMessaging(), { vapidKey: environment.firebase.vapidKey }).then(
(token) => deleteToken(getMessaging())
);
FirebaseError: Messaging: A problem occurred while unsubscribing the user from FCM: FirebaseError: Messaging: A problem occurred while unsubscribing the user from FCM: Requested entity was not found. (messaging/token-unsubscribe-failed). (messaging/token-unsubscribe-failed)
My configuration and code seems correct because if I run my app on Firefox browser, everything works fine and the token is correct
How can I fix this ? Is there a way to force firebase to refresh the client token and generate another valid one ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我终于将此固定在F12(开发人员工具)>应用>存储>清除站点数据。
Firebase现在生成一个用于调用API功能的新有效令牌。
I finally fixed this going to F12 (developer tools) > Application > Storage > Clear site data.
Firebase now generate a new valid token that works for calling API functions.