Firebase Notifications - Invalid reg token, please check token format in Android

10,051

UserID in console is not the registration token for Firebase messaging. By Firebase docs:

on initial startup of your app, the FCM SDK generates a registration token for the client app instance. If you want to target single devices or create device groups, you'll need to access this token by extending FirebaseInstanceIdService.

My last registration token looks like cpeBAc1NkUE:APA91bEpAKHQTdgkWVdDzDZG8BPon0APaIhbbuSejDpZF-FO1gD2saDV7_EQDo2WEz0H6e5U-uf0i-v4b25NXgGzV2oUrNuboM5675WY7VCP3JcBl8BCNY7eV0VFGHT9oRox0EEoo_ch

Share:
10,051
OM Tech
Author by

OM Tech

Updated on June 15, 2022

Comments

  • OM Tech
    OM Tech almost 2 years

    If I send push message by selecting a package from Firebase console, the push goes to all devices, but during sending to individual device, it displays the error:

    Invalid reg token,please check token format
    

    Error Snapshot:

  • OM Tech
    OM Tech about 7 years
    cbuJIjkg9zQ%3AAPA91bHavuWCuRuWIBrDOoHUK-RsjU1yewigurrYzHe0cP‌​iTQINykKjrLf8E0qEwJj‌​3XmJ1IoTmn0r2EoLR_mA‌​HGOjlA61CnQ8aSn2WxWK‌​KByOwbsnqoVeaeWQIeGU‌​_yh4wnZ67soLtI but here is difference, your token length is 152 but mine is 154.
  • AL.
    AL. about 7 years
    @jeevanthapa The format and length of a registration token varies so this shouldn't be an issue.
  • eurosecom
    eurosecom about 7 years
    I have gained registration token in my app by extending FirebaseInstanceIdService. Where in FB console did you print your token ?
  • AL.
    AL. about 7 years
    This is odd. Are you positive you're using the corresponding project (Sender ID) when sending to the generated registration token? Are you still seeing the same error?
  • OM Tech
    OM Tech about 7 years
    yes i have print and paste token i firebase console but it display invalid token.
  • eurosecom
    eurosecom about 7 years
    Try to get registration token in your app by extending FirebaseInstanceIdService. I do not know if it's the same.
  • OM Tech
    OM Tech about 7 years
    yes,, done,thank u @Al ,, it causes error because of using encoded token.
  • AL.
    AL. about 7 years
    @jeevanthapa Hi. Do accept a correct answer (by clicking on the check mark in the left part of an answer) in order for your post to be properly tagged. Cheers! :)