如何在用户注销时刷新 FCM 令牌? [英] How to refresh FCM Token on user Logout?

查看:17
本文介绍了如何在用户注销时刷新 FCM 令牌?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我第一次获得 FCM 并将其保存到我的 userDefaults.现在当用户注销时,如何再次刷新 FCM 令牌?我搜索了文档和许多其他问题,但没有找到更好的解决方案.

I am getting the FCM first time and save it to my userDefaults. Now When user logs out, how can I refresh the FCM token again? I have searched the docs and many other asked questions, but didn't find a better solution.

提前致谢.

推荐答案

FCM Token 是 Instance ID 令牌,它代表已安装的应用程序,而不是已登录的用户.通常,一旦应用保持安装状态,无论哪个用户登录,它都会拥有相同的令牌.

The FCM Token is an Instance ID token, it represents the installed app and not the signed in user. Generally once the app remains installed it will have the same token no matter what user is signed in.

您必须自己管理与令牌关联的用户.当用户登录时,您应该将令牌与用户的 ID 相关联,当用户退出时,您应该删除该关联.

You would have to manage what user is associated to the token yourself. When the user signs in you should associate the token with the user's ID and when the user signs out you should remove that association.

这篇关于如何在用户注销时刷新 FCM 令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆