Following Send a Push Notification Using a Token with below curl command
curl -v -H "apns-topic: pushnotify.com.xxxx.walletproject" -H "authorization: bearer xxxxx" -H "apns-id : eabexxxxx-xxxx-11e5-b60b-xxxxxxxx" -H "apns-push-type : alert" -H "apns-expiration : 0" -H "apns-priority : 10" --http2 --tlsv1.3 https://api.push.apple.com:2197/3/device/0a8163bxxxxxxxxxx -d '{"aps":{"alert":"hello xx"}}'
This returns 200 status code but no notification arrives to the phone. (All the notifications are enabled in the phone)
Below is the response
* Trying 17.188.171.97:2197...
* Connected to api.push.apple.com (17.188.171.97) port 2197 (#0)
* ALPN: offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* CAfile: C:\curl-7.88.1_2-win64-mingw\bin\curl-ca-bundle.crt
* CApath: none
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Request CERT (13):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Certificate (11):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN: server accepted h2
* Server certificate:
* subject: CN=api.push.apple.com; O=Apple Inc.; ST=California; C=US
* start date: Dec 19 17:22:50 2022 GMT
* expire date: Jan 18 17:22:49 2024 GMT
* subjectAltName: host "api.push.apple.com" matched cert's "api.push.apple.com"
* issuer: CN=Apple Public Server RSA CA 12 - G1; O=Apple Inc.; ST=California; C=US
* SSL certificate verify ok.
* using HTTP/2
* h2h3 [:method: POST]
* h2h3 [:path: /3/device/0a8163bxxxxxxxxxx]
* h2h3 [:scheme: https]
* h2h3 [:authority: api.push.apple.com:2197]
* h2h3 [user-agent: curl/7.88.1]
* h2h3 [accept: */*]
* h2h3 [apns-topic: pushnotify.com.xxxx.walletproject]
* h2h3 [authorization: bearer xxxxx]
* h2h3 [apns-id : eabexxxxx-xxxx-11e5-b60b-xxxxxxxx]
* h2h3 [apns-push-type : alert]
* h2h3 [apns-expiration : 0]
* h2h3 [apns-priority : 10]
* h2h3 [content-length: 24]
* h2h3 [content-type: application/x-www-form-urlencoded]
* Using Stream ID: 1 (easy handle 0x1f0fa3eba90)
> POST /3/device/0a8163bxxxxxxxxxx HTTP/2
> Host: api.push.apple.com:2197
> user-agent: curl/7.88.1
> accept: */*
> apns-topic: pushnotify.com.xxxx.walletproject
> authorization: bearer xxxx
> apns-id : eabexxxxx-xxxx-11e5-b60b-xxxxxxxx
> apns-push-type : alert
> apns-expiration : 0
> apns-priority : 10
> content-length: 24
> content-type: application/x-www-form-urlencoded
>
* We are completely uploaded and fine
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
< HTTP/2 200
< apns-id: xxxxxx-xxxxx-xxxxx-DD7A-xxxxxxx
<
* Connection #0 to host api.push.apple.com left intact
Any ideas what could be wrong here or a way to investigate this
I faced the same exact issue. Long story short It was an issue with the jwt token generation (even tho the response is correct don't rely on it) I was just using the bad Topic(Bundle Id). Make sure you are using the Topic(Bundle Id) you used to actual sign the Pass.pkpass and not the APNs one.