4

Does APNS or GCM device tokens have any special characters in them? we are trying to do server side validation of the tokens and need to know if we should just check for a-z0-9 and eliminate everything else?

Eran
  • 387,369
  • 54
  • 702
  • 768
Scoota P
  • 2,622
  • 7
  • 29
  • 45
  • For iOS I am sure it does not contain any special characters but I am not sure about android. So far I didn't saw any special charters in android also. – CoolMonster Apr 04 '14 at 12:02

1 Answers1

4

APNS device tokens are 32 bytes in binary format. If you choose to represent them as 64 hexadecimal characters, then they would contain just the hexadecimal characters (0 to 9 and A to F).

As for GCM Registration IDs, even though Google don't give any rules regarding possible characters, from what I observed, they use only 64 characters - A to Z, a to Z, 0 to 9, '-' and '_'.

Eran
  • 387,369
  • 54
  • 702
  • 768
  • 2
    I just received a registration token from GCM that was 152 characters, and it contained a colon: `ekO1-XdQYgk:APA91bHmgm_K500RVhexcxFVoczhp5RuMSKC07kOJB7T31xq2_a9tkUAFVGQNwtZ2JORj79lDRI0ow-nP17y82GD1zTWJTEnyjNMas_qNUKxBot1P-vM6v-BW7sqcISak8sXMK91WfmH` (modified it a bit) – Elad Nava Oct 04 '15 at 15:04
  • 1
    @EladNava Interesting. I guess things changed since the last time I checked. – Eran Oct 05 '15 at 14:28
  • Yeah, they haven't defined any pattern or allowed characters. See this: http://stackoverflow.com/a/12502351/1123355 – Elad Nava Oct 05 '15 at 14:38