alexalok / dotAPNS

dotAPNS is a library used to send push notifications to Apple devices using Apple Push Notification service via HTTP/2 API.
Apache License 2.0
114 stars 34 forks source link

Getting "InvalidProviderToken" while calling sendAsync #85

Closed Hiteshdprajapati closed 3 years ago

Hiteshdprajapati commented 3 years ago
        var options = new ApnsJwtOptions()
        {
            BundleId = "xxx.xxx",
            //CertContent = "",
            CertFilePath = @"path  of .p8",
            KeyId = "keyid",
            TeamId = "teamid"
        };
     ApnsClient apns = ApnsClient.CreateUsingJwt(new HttpClient(new WinHttpHandler()), options);
             var push = new ApplePush(ApplePushType.Alert)
                .AddAlert("title", message)
                .AddToken(device_token);

        var response = await apns.SendAsync(push);
alexalok commented 3 years ago

Please make sure KeyId and TeamId are set correctly and that the p8 certificate you're using is not revoked or expired.

Hiteshdprajapati commented 3 years ago

I have changed .p8 certificate and its working fine now
Thanks @alexalok !!!

alexalok commented 3 years ago

Glad I could help!