Remove push notifications token from Expo server

1.4k Views Asked by At

In order to use expo-notifications, I use this approach:
-show an onboarding screen where user can accept to receive the notifications
-if the user accepted to receive the notifications, I will call the getExpoPushTokenAsync() to get the expo push notifications token, then will store it in the database with the customer id.

The issue is that I have an option where the user can choose to not receive the notifications anymore, and I need to remove the push notifications token from the Expo server. I didn't find any "removeExpoPushToken" method on the expo-notifications. Do you have any idea if this could be done?

P.S: I don't want to remove it from the database, I will just need to remove it from Expo, so when I try to send notifications based on that token, I should get invalid push notifications token.

1

There are 1 best solutions below

0
On BEST ANSWER

I've also tried to search for a way to revoke an ExpoPushToken but could not find it in the docs. Searching for another solution, I've found this discussion on Github:

https://github.com/expo/expo/issues/10684#issuecomment-708875779

Where Brent Vatne (one of the main Expo maintainers) confirmed that there is no way to revoke this token on the client side. Unfortunally, he suggested exactly what you didn't want: delete it from your database.

Is there a reason to not remove it from your database?

Hope it helps