MDM TokenUpdate Token

I'm receiving the TokenUpdate from the device, but it looks like:



<key>Token</key>
<data>
tXYV0+IN3+/qUaJa3P1OUclO4AJQTOGb6SjjAVTyF40=
</data>


How do I decode the Token data so I can use it for an APNS notification?

Posted on Sep 2, 2012 10:25 PM

Reply
3 replies

May 6, 2013 2:36 AM in response to Thoths

Hi there,


I have been working on this issues for a while as we're developing an MDM service at the moment. As we all know, the Apple documentation on MDM is anything but helpful as much as we would like to.


So what happens here is that you're receiving the deviceToken as a Base64 string. In order to use it, you just have to Base64 decode it and send the resulting result as is. If you try to "print" the resulting result of the decoding, you will see that instead of looking like the regular "XXXX-XXXX...." that is commonly known, it looks like garbage. That is because it is actually binary data.


Sending your MDM commands with it decoded like that should work without a problem. However, I found out that some libraries (if you're using one of the libraries out there to do the final send) do not accept the binary format. All you have to do then is to find a function in the language you're using to turn it into a HEX string.


In my case I am using PHP. So this is what it turns out to be:


$token = bin2hex(base64_decode($deviceToken));


I hope this helps.


Regards.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

MDM TokenUpdate Token

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.