Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I receive MissingProviderToken error with APNs

I am sending a push notification in Golang with a certificate on iOS via APNs and I receive MissingProviderToken error. Indeed, debugging the code, I see that the client has a null token. I use sideshow library, sideshow/apns2.

cert, err := certificate.FromP12File("./certificates.p12", "*filepassword*")

if err != nil {
   log.Fatal("Cert Error:", err)
}
notification := &apns2.Notification{}
notification.DeviceToken = *deviceToken*
notification.Topic = "*appbundleid*"
notification.Payload = []byte(`{
      "aps" : {
         "alert" : "Hello!"
      }
   }
`)

client := apns2.NewClient(cert).Production()
res, err := client.Push(notification)

Does this token need to be passed by the certificate?

I tried two different certificates created by my company but still returns 403 MissingProviderToken. I tried also client := apns2.NewClient(cert).Development() Can I manually pass token just to try? Did anyone experience this or where am I making a mistake?

like image 206
rightphalange Avatar asked Oct 29 '25 14:10

rightphalange


1 Answers

From this guide Local and Remote Notification Programming Guide: Communicating with APNs, it means No provider certificate was used to connect to APNs and Authorization header was missing or no provider token was specified.

So, change the certificate.

like image 56
Peter Avatar answered Oct 31 '25 06:10

Peter



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!