0
  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.

Hi, I'm using react native with expo and expo-notifications, and send notifications with firebase messages in firebase functions.

The integration works great with android, not so much with iOS, the token that's returned seems to be an apn token not an FCM, and firebase admin rejects the token with "The registration token is not a valid FCM registration token"

I tried to use "https://iid.googleapis.com/iid/v1:batchImport" (following this guide: https://www.thepolyglotdeveloper.com/2017/06/apns-tokens-fcm-tokens-simple-http/) with returns a valid FCM token, and works with Firebase Notification Composer, I can get notifications through that interface, but if I try to do the conversion and send notifications from the generated FCM using firebase i get an error from firebase "SenderId mismatch".

I have the credentials correctly added into firebase iOS client, as proven by the Firebase Notification Composer, but somehow, expo is returning a token that is not signed with the same SenderId as firebase and the admin does a check the Composer does not? No sure what's the case.

In short:

I would like to get a FCM token from Notifications.getDevicePushTokenAsync(), which should be possible, or was possible (at least there are some discussions in the github issues).

The firebase function code is :

  return admin
    .messaging()
    .send({
      token: registrationTokens,
      data: {...}

and the react native:

token = (await Notifications.getDevicePushTokenAsync()).data;

(both work perfect with Android)

also in expo forum: https://forums.expo.io/t/expo-notifications-getdevicepushtokenasync-on-ios-returns-a-token-thats-not-fcm-and-does-not-work-with-firebase/52155

Coding Edgar
  • 1,285
  • 1
  • 8
  • 22

0 Answers0