capacitor-plugins icon indicating copy to clipboard operation
capacitor-plugins copied to clipboard

Delete the Push FCM Token to get a new one

Open JustDoItSascha opened this issue 2 years ago • 10 comments

Feature Request

Plugin

@capacitor/push-notifications

Description

It would be nice if there is a option to delete the current token and get a new one from FCM. Because we an delete the token from the user server side, but there are circumstances where this could fail and then a user gets notifications even when he is logged out. So the option to get a fresh fcm token would be nice.

JustDoItSascha avatar Jul 28 '22 11:07 JustDoItSascha

+1

josuelmm avatar Aug 02 '22 21:08 josuelmm

Good day, in the plugin https://www.npmjs.com/package/cordova-plugin-fcm-with-dependecy-updated Exists a function for regenerate a new token. Is it possible to do the same with this plugin?

josuelmm avatar Aug 02 '22 21:08 josuelmm

@josuelmm Did you try the deleteInstanceId() function in the plugin you posted? Because we did and it doesn't seem to work. The token from this plugin is also always the same.

And the tokens from that plugin and from this plugin here are not the same!

JustDoItSascha avatar Aug 03 '22 07:08 JustDoItSascha

The function "deleteInstanceId" does not exist inside the plugin's definitions.d.ts

josuelmm avatar Aug 03 '22 10:08 josuelmm

I mean from the plugin you posted, there is a FCM.deleteInstanceId() function. I think that is the function to regenerate the token you meant?

JustDoItSascha avatar Aug 03 '22 10:08 JustDoItSascha

Yes but it is an old plugin.

josuelmm avatar Aug 03 '22 16:08 josuelmm

I just made the modification in the source code and it works for me. I created a delete function and then run register again and it generated another token for me.

josuelmm avatar Aug 04 '22 12:08 josuelmm

Awesome! Could you share your modifications? I'm totally lost. Thanks!

JustDoItSascha avatar Aug 04 '22 13:08 JustDoItSascha

Check this => https://github.com/ionic-team/capacitor-plugins/pull/1110

josuelmm avatar Aug 04 '22 17:08 josuelmm

Could this be merged to the original repo? I think this is a must have! :)

sasos90 avatar Sep 15 '22 20:09 sasos90

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.

ionitron-bot[bot] avatar Apr 23 '23 20:04 ionitron-bot[bot]