kreait / laravel-firebase

A Laravel package for the Firebase PHP Admin SDK

Home Page:https://github.com/kreait/firebase-php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The registration token is not a valid FCM registration token

tusharbudhe0302 opened this issue · comments

Hi Team,

Thanks for allowing to ask a question. I am getting token from front end. On Server I am using firebase-admin package.

Code trying to execute Step 1:

      app.messaging().send(message).then((res) => {
        console.log(`successfully send push notification ${res}`);
       }).catch((error) => {
         console.log(`falied send push notification ${error}`);
       });

It has new token length is 312. I trying to push this token.

{
  "data": {
    "type": "PURCHASE_STATUS",
    "checkoutId": "ancded",
    "status": "COMPLETED"
  },
  "notification": {
    "title": "Your total's $8.99",
    "body": "You're ready to roll! Open to see your receipt."
  },
  "android": {
    "notification": {
      "clickAction": "com.abc.def.android.PURCHASE_COMPLETED"
    }
  },
  "token": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6IjE6NzY3NDA5MDI2NjU5OmFuZHJvaWQ6NWQ2ZWE5YmE4ZjY1NDM1OCIsImV4cCI6MTY1MTA4NzA0NCwiZmlkIjoiZlczNlUzcTNUZ2VkNHdHdTE0OGlMVCIsInByb2plY3ROdW1iZXIiOjc2NzQwOTAyNjY1OX0.AB2LPV8wRgIhALC_uiwrKb8BuVDVTWArOFxf6c5bXbdaDP6buDEH3b_UAiEAmXntReGszPtqcTCMOim-yR0lgdj_FsuzZUo_yDcvzcY"
}

I am getting below error:

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

But same code Step 1 is working with old token length is 163.

{
  "data": {
    "type": "PURCHASE_STATUS",
    "checkoutId": "9b3af6ec-9bd3-46f0-b217-521bb234e0c7",
    "status": "COMPLETED"
  },
  "notification": {
    "title": "Your total's $8.79",
    "body": "You're ready to roll! Open to see your receipt."
  },
  "android": {
    "notification": {
      "clickAction": "com.abc.def.android.PURCHASE_COMPLETED"
    }
  },
  "token": "eFqo4pTT4olhMw8aKsxEOb:APA91bG3SviDNg2ibd9CuSf8cAXewFOMT-iKtiQYSnPRG54eamE5Uq5bs2G2e0Vr1Zq9HI2_-5kbkio5eTUI79jZpVWl-YBB_8Fu54K3VYBmhDbQ3vNSgmV7z-B8Suenz-GIduPOASSK"
}

Please let me know what correction needed at my end? How I can solve this problem? Is there any latest update on firebase service causing this issue?

@jeromegamez : I know you are dude for this. It will great help, please look for above issue.

I'm the only "dude" here, so no need to ping me specifically, I get notifications about new issues anyway 😓

Please try using the issue search next time, this would have led you to, for example, #31 (comment) or kreait/firebase-php#484 (comment)

Nonetheless, it's good that you brought it up, I added https://github.com/kreait/firebase-php/projects/4#card-81296556 so that I remember to document it in the docs. Thanks!