Expo Push Tokens are the same on different devices with different APN tokens

Please provide the following:

  1. SDK Version: 40
  2. Platforms(Android/iOS/web/all): iOS
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

Hey guys, thanks for your awesome work!
We are experiencing a problem regarding push token creation. As this answer states: [Push Notifications] Old and new Notifications API return different push notification tokens for the same device - #5 by victorwads
When calling Expo.getPushToken(), Expo handles sending local APN to Expo Notification service and generating a new token - if necessary.

In our case, we have two devices. A chat application is developed. On each device, there is a unique user logged in and they are trying to send each other a push notification over a server.

On login, they get their respective push token and send it to the server, which updates it in its database. User A then sends a message to user B, but as both have the same Expo Push token, he might probably end up receiving his own message.

We can see the field “devicePushToken” being different on each device. How can the Expo push token be the same?

Side note: in this case, the device of User B has been created by a backup of the device of User A (Apple backup restore during device setup). On of our other developers has had no problem with this method and push tokens are unique.

Thanks for any comment!

hi! Thanks for the question

this should have been fixed in SDK 40 (here’s the relevant github issue- Push Notifications don't work on new phone that is restored from an old phone due to duplicate device ID · Issue #6051 · expo/expo · GitHub)

Are you using the managed workflow, or bare?

Thanks for the quick reply!

I double-checked - we are using Expo SDK v40.0.1 and we are following the managed workflow. We upgraded from Expo SDK 39 to Expo SDK 40 mid March. Could it be some sort of leftover error?

We tried reinstalling Expo Go app from App Store on both devices but both tokens are the same. Could this somehow be related to Expo user accounts?

If there is any information you need for debugging purposes I will be happy to get it for you.

We upgraded from Expo SDK 39 to Expo SDK 40

Hm, no this should be fixed in that case. So this is happening in Expo Go, or your standalone IPA, or both?

You may want to try upgrading to SDK 41, although this bug was definitely fixed in SDK 40

Hi again, the developer is using two physical devices, both running our development app in Expo Go. So two devices, both running Expo Go, both running our app. When our app codes calls “await Notifications.getExpoPushTokenAsync()”, both send the same Expo push token to the server.

I have scheduled to upgrade Expo SDK to 41 for next week. Maybe this will solve the issue.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.