0

Every time when users logout the app must be don't receiving push notifications for that user (revoke token), and every time when users login it must be new APNs token generated, so user will not receive notifications for previous logged in users. For example now, when user logged out the app still receiving notifications even if nobody logged in back. I can't handle logout event, because user can be offline when he presses Logout button. Is it possible?

3
  • 1
    duplicate stackoverflow.com/questions/42851474/… Messaging.messaging().deleteToken { error in if let error = error { print("❌ Error deleting FCM token: (error.localizedDescription)") } else { print("✅ FCM token deleted successfully") } } Commented Jul 11 at 11:33
  • You should keep a mapping of userid->token on your server. When the user logs out you remove this mapping so that there is no user mapped to the token (even though the token itself is still valid). When a user logs in, update the mapping. Commented Jul 11 at 20:34
  • yes, but as I said user can logout in time when there is no internet on device, so backend will not get request. so I believe it is better to refresh token somehow when users logout also Commented Jul 12 at 13:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.