Push notification 'APNS_BAD_DEVICE_TOKEN'

Hi guys,

I have Ionic Push Alpha functionality in my app for a while and I want to switch to the new Ionic Push Beta functionality. When I build my iOS app and run it on my iPhone I get a device token which I use to send a push notification via the new API. But sending a notification fails. When I check the status of my notification with the uuid I see the error ‘APNS_BAD_DEVICE_TOKEN’. What do I have to do? Thanks!

Mark

Same issue :unamused:

The specified device token was bad. Verify that you specified a valid token.

My device token is valid ? ( [valid] => 1 )

[data] => Array
        (
            [0] => stdClass Object
                (
                    [status] => error
                    [created] => 2016-04-19T17:28:48.297153+00:00
                    [uuid] => cc047ddf-0fb6-46c4-9066-XXXXXXX
                    [error] => APNS_BAD_DEVICE_TOKEN
                    [token] => stdClass Object
                        (
                            [app_id] => 899xxxx
                            [id] => 98161XXXXXXX
                            [type] => ios
                            [created] => 2016-04-19T17:24:56.534989+00:00
                            [token] => 681681XXXXXXXXXXXX
                            [valid] => 1
                            [invalidated] => 
                        )

                    [user_id] => 
                    [notification] => XXXXXXX-ef9XXXXXXX
                )

        )

)

Just create new security profile for production and upload my certificat (production). Works fine for me now.

Before, I upload certificate in development but my app is in production.

1 Like

Nice! Maybe I have the same issue, becauce I only made a development security profile yet. I’ll give it a try later and let you know if it did the trick.

Nice! I’ve made a production security profile with the necessary certificates and that did the trick! Thanks!

This worked for me too, thanks, but it seems like a bug that Development push certs don’t generate valid tokens. I think they used to.

It doesn’t work for me. I set a production profile but my app token always get error APNS_BAD_DEVICE_TOKEN :frowning:

Same issue here. I set:

  • Production profile with production p12 file
  • dev_push: false
  • ionic push --production-mode=y
  • ionic build ios
  • run the app with xcode
  • copy the device token from the console

When i request i get this error: APNS_BAD_DEVICE_TOKEN

:joy:

( it works perfectly with my Android device )

The answer :

In addition, running the app through xCode will usually generate a development build, and will need to use the APNS development gateway with a development certificate, not a production one.In addition, running the app through xCode will usually generate a development build, and will need to use the APNS development gateway with a development certificate, not a production one.

https://github.com/driftyco/ionic-platform-issues/issues/124

1 Like