The registration token is not a valid FCM registration token
Asked Answered
V

1

12

I'm trying to send a message to my device using a token I've gotten from a ticket saved in my PassWallet app in my Android device.

The device sends all the information required to update a pass using apple's wallet spec. However, I'm using FCM to send the notification and I'm getting this error: "The registration token is not a valid FCM registration token"

{
errorInfo: 
   { code: 'messaging/invalid-argument',
     message: 'The registration token is not a valid FCM registration token' },
  codePrefix: 'messaging' 
}

The code I'm using to send the message is the one from the Admin SDK sample:

var message = {
        token: device.pushToken
      };

      admin.messaging().send(message)
        .then((response) => {
          console.log('Successfully sent message:', response);
        })
        .catch((error) => {
          console.log('Error sending message:', error);
        });
  • I'm not sure if my message is incomplete and I need something else in the body.

  • If the token expired (Where you can verify this on Firebase).

  • If the message needs to specify whether is Android, iOS(APNS), etc...

This is the full stack trace:

Error: The registration token is not a valid FCM registration token
    at FirebaseMessagingError.FirebaseError [as constructor] (/srv/node_modules/firebase-admin/lib/utils/error.js:39:28)
    at FirebaseMessagingError.PrefixedFirebaseError [as constructor] (/srv/node_modules/firebase-admin/lib/utils/error.js:85:28)
    at new FirebaseMessagingError (/srv/node_modules/firebase-admin/lib/utils/error.js:241:16)
    at Function.FirebaseMessagingError.fromServerError (/srv/node_modules/firebase-admin/lib/utils/error.js:271:16)
    at FirebaseMessagingRequestHandler.handleHttpError (/srv/node_modules/firebase-admin/lib/messaging/messaging-api-request.js:125:50)
    at /srv/node_modules/firebase-admin/lib/messaging/messaging-api-request.js:113:23
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:229:7)
  errorInfo: 
   { code: 'messaging/invalid-argument',
     message: 'The registration token is not a valid FCM registration token' },
  codePrefix: 'messaging' }
Vanvanadate answered 5/1, 2019 at 0:18 Comment(8)
I don't think PassWallet tokens are valid FCM tokens. To get a valid FCM token, see firebase.google.com/docs/cloud-messaging/ios/…Sanders
Hi Frank, I'm not sure if what you are suggesting is send a message using apns or only generate new ones. The thing is passwallet is an app that I don't control but they use .pkpass files as in iOS wallet, is it possible for me to send notifications to this app through apn.Vanvanadate
To send messages through FCM you need an FCM token. And whatever you get from passwallet doesn't seem to be a valid FCM token.Sanders
Frank you are right about the token being the problem. I tried to send a message through postman and curl and I'm getting this error in the response: "error": "InvalidRegistration". And it's when I use the pushToken returned by the pkpass file to send the notification to that device. What I'm not sure is how to make that token a valid token for FCM or if I should use APNS insteadVanvanadate
@FrankvanPuffelen, based on this question #37465206. I think that what I need to do is convert the APN token into a FCM token, but the batchImport requires an application and says is the app Bundle. The thing is I want the tokens to work no matter of the wallet app the user has in their phone. What should I do in this case? I'm getting this response "message_id": "0:1547059178561977%9ba8a687f9fd7ecd" from a fake application package which means I my poor knowledge that the message was sentVanvanadate
I'm not sure how Wallet apps work. In general I think that you need to have an app ID to be able to send a notification to that app. But I admit that my knowledge on this is quite limited, so hope somebody else at this point might know more. It could also be that you should post a new question now explaining how you're trying to convert a Wallet token to an FCM token, and showing the API you're trying to call.Sanders
Frank you were right, after converting those tokens I was able to send messages sometimes then I started receiving some other error I posted another question with more details, thanks for your help.Vanvanadate
Hello @Vanvanadate Im facing the same problem. How exactly did you solve the problem? Can I contact you on skype or something? Best regards, DennisFilomena
S
-1

All information about the updated pass you should send to the Passwallet server. Please find the latest instructions here: https://github.com/Kwiket/passwallet

Passwallet Team

Synoptic answered 7/2, 2020 at 15:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.