How to refresh FCM Token on user Logout?

后端 未结 2 1057
挽巷
挽巷 2021-01-03 07:23

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

相关标签:
2条回答
  • 2021-01-03 08:05

    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.

    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.

    0 讨论(0)
  • 2021-01-03 08:08

    Check this post: Firebase Cloud Messaging - Handling logout

    Mentioned security issue in @Arthur's comment is solved!

    0 讨论(0)
提交回复
热议问题