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
Author by
OM Tech
Updated on June 15, 2022Comments
-
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 about 7 yearscbuJIjkg9zQ%3AAPA91bHavuWCuRuWIBrDOoHUK-RsjU1yewigurrYzHe0cPiTQINykKjrLf8E0qEwJj3XmJ1IoTmn0r2EoLR_mAHGOjlA61CnQ8aSn2WxWKKByOwbsnqoVeaeWQIeGU_yh4wnZ67soLtI but here is difference, your token length is 152 but mine is 154.
-
AL. about 7 years@jeevanthapa The format and length of a registration token varies so this shouldn't be an issue.
-
eurosecom about 7 yearsI have gained registration token in my app by extending FirebaseInstanceIdService. Where in FB console did you print your token ?
-
AL. about 7 yearsThis 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 about 7 yearsyes i have print and paste token i firebase console but it display invalid token.
-
eurosecom about 7 yearsTry to get registration token in your app by extending FirebaseInstanceIdService. I do not know if it's the same.
-
OM Tech about 7 yearsyes,, done,thank u @Al ,, it causes error because of using encoded token.
-
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! :)