others-how to renew apple push notification certificate?

1. Purpose

In this post, I will demonstrate how to renew apple ios push notification certificate when it’s about to expire or it has been expired.

When you got this email from apple:

Action Needed: Apple Push Services Certificate Expires in 30 Days

Dear xxx,

Your Apple Push Services Certificate will no longer be valid in 30 days. To generate a new certificate, sign in and visit Certificates, Identifiers & Profiles.

Certificate: Apple Push Services
Identifier: yyy
Team ID: zzzzzzzz

To learn more about expired certificates, visit the certificates support page.

Best regards,
Apple Developer Relations

Get the certificate info in keychain access:

You can see that the certificate is about to expire in 30 days. How to renew it?
You should consider to create a new push certificate.



2. Solution

Click create certificate in apple developer center:

When it prompts to provide a CSR file:

Upload a Certificate Signing Request
To manually generate a Certificate, you need a Certificate Signing Request (CSR) file from your Mac.

You can just open your keychain access application in your Macbook , and then click Keychain access-->Certificate Assistant-->Request a certificate from certificate authority, then you can see this:

save the csr file to your disk ,and then upload to the above form, click contintue, you would get this:

click download. And then double click the aps.cer file.

If you get this error:

apple push service certificate is not trusted

just goto https://www.apple.com/certificateauthority/ to get apple root certificate, for me, I click and download the G4 certificate, double click and install it, then everything works!

then export the newly created certificate to .p12 format.

Then use the file in your code:

@Configuration
public class ApnConfig {
    @Bean
    @Qualifier("prodApnsClient")
    public ApnsClient getApnsClientProd() throws IOException {
        return new ApnsClientBuilder()
                .setApnsServer(ApnsClientBuilder.PRODUCTION_APNS_HOST)
                .setClientCredentials(new File(iFaceSettings.getConfigPath()+"prod-push.p12"),"xxxxxxx")
                .build();
    }



3. Summary

In this post, I demonstrated how to renew apple ios push notification certificate . That’s it, thanks for your reading.