How to send push notification only if user is logged in


We are building an app with authentication using Expo and cognito and we have some scheduled push notifications for our users, but how we can send this notifications only if the user is logged in in the app?


I think you can only handle this through the backend by basically not sending the notification at all. Notifications are handled by the OS and there’s only so much you can do about them after they’re received.

You need to notify your API that the user has logged out and you need to remove or invalidate their expo push token. That’s how we do it. Just in case, I also check if the user is logged in when handling the notification.

Thanks, good idea, is theere any way to manually invalidate a expo token?