SherClockHolmes / webpush-go

Web Push API Encryption with VAPID support.
MIT License
325 stars 68 forks source link

send push message to ios return 403 #61

Closed ennnnzo closed 10 months ago

ennnnzo commented 10 months ago

It works for me to send push message to https://fcm.googleapis.com/fcm/send/

But if send to https://web.push.apple.com/ returns 403

 {"reason":"BadJwtToken"}
ennnnzo commented 10 months ago

I just didnt set subscriber in options.If set , It works.

leomorpho commented 4 months ago

Indeed! Thanks for posting this as I was completely puzzled as to why it was working on desktop but not iOS!

resp, err := webpush.SendNotification([]byte(message), &pushSub, &webpush.Options{
            Subscriber:      "the-email-of-your-platform-sending-the-push-notif@test.com",
            VAPIDPublicKey:  vapidPublicKey,
            VAPIDPrivateKey: vapidPrivateKey,
        })