Invalid token

1,429 views
Skip to first unread message

Pradeep Padanthaya

unread,
Aug 10, 2011, 10:56:12 PM8/10/11
to apns-php
Hi,

I am getting this invalid token error though I am pretty sure that I
am using the correct device token generated by APNS. The stack trace
is below. Any help is greatly appreciated..

Wed, 10 Aug 2011 22:56:30 -0400 ApnsPHP[19236]: INFO: Trying
ssl://gateway.sandbox.push.apple.com:2195... Wed, 10 Aug 2011 22:56:30
-0400 ApnsPHP[19236]: INFO: Connected to ssl://gateway.sandbox.push.apple.com:2195.
object(ApnsPHP_Message)#2 (8)
{ ["_bAutoAdjustLongPayload":protected]=> bool(true)
["_aDeviceTokens":protected]=> array(1) { [0]=> string(64)
"aaea54fa09e4c6b20f9f4bf1b8692211cc253b437b830d70af08c1221b397d93" }
["_sText":protected]=> string(10) "News items" ["_nBadge":protected]=>
int(1) ["_sSound":protected]=> string(7)
"default" ["_aCustomProperties":protected]=> NULL
["_nExpiryValue":protected]=> int(30)
["_mCustomIdentifier":protected]=> string(2) "BV" } Wed, 10 Aug 2011
22:56:30 -0400 ApnsPHP[19236]: INFO: Sending messages queue, run #1: 1
message(s) left in queue. Wed, 10 Aug 2011 22:56:30 -0400
ApnsPHP[19236]: STATUS: Sending message ID 1 [custom identifier: BV]
(1/3): 103 bytes. Wed, 10 Aug 2011 22:56:31 -0400 ApnsPHP[19236]:
ERROR: Unable to send message ID 1: Invalid token (8). Wed, 10 Aug
2011 22:56:31 -0400 ApnsPHP[19236]: INFO: Disconnected. Wed, 10 Aug
2011 22:56:31 -0400 ApnsPHP[19236]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
Wed, 10 Aug 2011 22:56:31 -0400 ApnsPHP[19236]: INFO: Connected to
ssl://gateway.sandbox.push.apple.com:2195. Wed, 10 Aug 2011 22:56:31
-0400 ApnsPHP[19236]: INFO: Sending messages queue, run #2: 1
message(s) left in queue. Wed, 10 Aug 2011 22:56:31 -0400
ApnsPHP[19236]: WARNING: Message ID 1 [custom identifier: BV] has an
unrecoverable error (8), removing from queue without retrying... Wed,
10 Aug 2011 22:56:32 -0400 ApnsPHP[19236]: INFO: Disconnected.
array(1) { [1]=> array(3) { ["MESSAGE"]=> object(ApnsPHP_Message)#2
(8) { ["_bAutoAdjustLongPayload":protected]=> bool(true)
["_aDeviceTokens":protected]=> array(1) { [0]=> string(64)
"aaea54fa09e4c6b20f9f4bf1b8692211cc253b437b830d70af08c1221b397d93" }
["_sText":protected]=> string(10) "News items" ["_nBadge":protected]=>
int(1) ["_sSound":protected]=> string(7)
"default" ["_aCustomProperties":protected]=> NULL
["_nExpiryValue":protected]=> int(30)
["_mCustomIdentifier":protected]=> string(2) "BV" }
["BINARY_NOTIFICATION"]=> string(103) " NCD� ��T� �Ʋ �K�i" �%;C{�
p� �" 9}�:{"aps":{"alert":"News items","badge":
1,"sound":"default"}}" ["ERRORS"]=> array(1) { [0]=> array(5)
{ ["command"]=> int(8) ["statusCode"]=> int(8) ["identifier"]=> int(1)
["time"]=> int(1313031391) ["statusMessage"]=> string(13) "Invalid
token" } } } }

Aldo Armiento

unread,
Aug 16, 2011, 6:14:32 AM8/16/11
to apns-php
If Apple says "Invalid token" we can't do nothink. Did you register
your device and application to apple server?

ric...@gmail.com

unread,
Apr 12, 2013, 10:45:25 AM4/12/13
to apns...@googlegroups.com, pjpra...@gmail.com
I get the same issue, i am also very sure I registered the app and also get the token correctly.

Here is the output of sample_push.php:

Fri, 12 Apr 2013 22:43:54 +0800 ApnsPHP[2727]: INFO: Trying ssl://gateway.push.apple.com:2195... Fri, 12 Apr 2013 22:43:55 +0800 ApnsPHP[2727]: INFO: Connected to ssl://gateway.push.apple.com:2195. Fri, 12 Apr 2013 22:43:55 +0800 ApnsPHP[2727]: INFO: Sending messages queue, run #1: 1 message(s) left in queue. Fri, 12 Apr 2013 22:43:55 +0800 ApnsPHP[2727]: STATUS: Sending message ID 1 [custom identifier: Message-Badge-3] (1/3): 167 bytes. Fri, 12 Apr 2013 22:43:56 +0800 ApnsPHP[2727]: ERROR: Unable to send message ID 1: Invalid token (8). Fri, 12 Apr 2013 22:43:56 +0800 ApnsPHP[2727]: INFO: Disconnected. Fri, 12 Apr 2013 22:43:56 +0800 ApnsPHP[2727]: INFO: Trying ssl://gateway.push.apple.com:2195... Fri, 12 Apr 2013 22:43:56 +0800 ApnsPHP[2727]: INFO: Connected to ssl://gateway.push.apple.com:2195. Fri, 12 Apr 2013 22:43:56 +0800 ApnsPHP[2727]: INFO: Sending messages queue, run #2: 1 message(s) left in queue. Fri, 12 Apr 2013 22:43:56 +0800 ApnsPHP[2727]: WARNING: Message ID 1 [custom identifier: Message-Badge-3] has an unrecoverable error (8), removing from queue without retrying... Fri, 12 Apr 2013 22:43:57 +0800 ApnsPHP[2727]: INFO: Disconnected. array(1) { [1] => array(3) { 'MESSAGE' => class ApnsPHP_Message#3 (9) { protected $_bAutoAdjustLongPayload => bool(true) protected $_aDeviceTokens => array(1) { ... } protected $_sText => string(26) "Hello APNs-enabled device!" protected $_nBadge => int(1) protected $_sSound => string(7) "default" protected $_bContentAvailable => NULL protected $_aCustomProperties => array(2) { ... } protected $_nExpiryValue => int(30) protected $_mCustomIdentifier => string(15) "Message-Badge-3" } 'BINARY_NOTIFICATION' => string(167) "\001\000\000\000\001Qh\035É\000 Wù\033\000 ‚¦K˜ìé Ý7ùy\b\aZIãfN$Q1WÔ[i v\000z{"aps":{"alert":"Hello APNs-enabled device!","badge":1,"sound":"default"},"acme2":["bang","whiz"],"acme3":["bing","bong"]}" 'ERRORS' => array(1) { [0] => array(5) { ... } } } }

Pradeep Padanthaya於 2011年8月11日星期四UTC+8上午10時56分12秒寫道:

ric...@gmail.com

unread,
Apr 12, 2013, 11:05:08 AM4/12/13
to apns...@googlegroups.com, pjpra...@gmail.com, ric...@gmail.com
Hi all,

After I change my ".pem" file to a development one, also when creating the push object as follow:

$push = new ApnsPHP_Push(
ApnsPHP_Abstract::ENVIRONMENT_SANDBOX,
'MyPushAppDev.pem'
);

Use the ENVIRONMENT_SANDBOX, then it works fine in the development environment.

Hope this help you.

But I will start to develop the real push notification, do I have any method to test it before launching? Or what steps should I do before launch?

ric...@gmail.com於 2013年4月12日星期五UTC+8下午10時45分25秒寫道:
Reply all
Reply to author
Forward
0 new messages