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' }
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