Skip to content

🐛 [Messaging] FCM token does not refresh after deleting token via deleteToken() on iOS  #6766

@helenaford

Description

@helenaford

Bug report

Describe the bug
Prior to installations, deleteToken on iOS is used to refresh the token. Since the update, no longer invalidates the token.

Also please see the related issue for RNFB invertase/react-native-firebase#5570

I believe you have to delete the installations id first which then makes subsequent calls of deleteToken generate a new one

Steps to reproduce the behavior:

  1. call await FirebaseMessaging.instance.deleteToken();
  2. call await FirebaseMessaging.instance.getToken();
  3. See that the token has not changed

Expected behavior

A new FCM token should be generated, and the old one should be invalidated

Sample project

The current messaging example app on master branch, with the following button added:

      ElevatedButton(
          onPressed: () async {
            print('Example: Getting FCM before');
            String before = await FirebaseMessaging.instance.getToken();
            await FirebaseMessaging.instance.deleteToken();
            String after = await FirebaseMessaging.instance.getToken();
            print('CHANGED token?? : ${before != after}');
          },
          child: const Text('Delete token')),

Additional context

Add any other context about the problem here.


Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand
PASTE OUTPUT INSIDE HERE

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand
PASTE OUTPUT INSIDE HERE

Metadata

Metadata

Assignees

No one assigned

    Labels

    resolution: fixedA fix has been merged or is pending merge from a PR.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions