Search code examples
iosswiftapple-push-notificationsvoippushkit

Invalid Token VoIP Apple Push Notification


I'm trying to implement VoIP push notification for my VoIP app. I have generated apple push notification certificate and VoIP push notification certificate.

I have generated a p12 file from the certificate which I downloaded from apple developer account.
And when I am trying to send push notification from my app server to apple server, I'm getting invalid token.

I have looked into these links in SO:

APNS: invalid token (8)
APNS: Invalid token causes all subsequent push notifications to fail
APNS server responds with status 8-invalid-token, but devices are being registered properly
iOS Push notifications : invalid tokens
"Invalid Token" while sending PushKit notification in production environment

And still so many more links.

From after following all links, I have checked all these below things mentioned from the links.

My device is able to generate a push token. I'm able to send that to my app server. I have verified when sending a request to an apple push server, token id is same. I'm able to generate a p12 file from the certificate by following the steps mentioned in the above links.

But still, I get the error invalid token. I still can't figure out what I'm missing? How can I check whether my token is valid? How can I check whether the p12 file generated is valid and correct? When sending push notifications from android firebase, I have the option to send from firebase console. Is there any console to check apple push notification?


Solution

  • Finally i found the solution.
    Its my mistake, since i created my p12 certificate from apple push notification certificate instead of voIP push notification certificate.
    I followed this link in SO
    https://stackoverflow.com/a/40760469/6059583
    That link provided me with a tool which gets all the certificates from toolchain.
    After choosing push notification certificate, i gave a try with voIP push notification certificate to send a notification.
    And i got my push notification from my server.
    If incase someone seems to be having invalid token, kindly make sure the certificate is correct.

    You can also use the link given by iDeveloper, that tool also seems nice.But u need to select the certificates and give it to the tool.