iOS: Establishing a Connection to APNs
Understanding token-based (.p8) and certificate-based (.p12) connections to connect to APNs (Apple Push Notification Service)
APNs is a system provided by Apple to send notifications to devices running iOS (such as the iPad and iPhone). It is also used to deliver notifications to macOS native applications and for Safari Web Push.
Apple provides two authentication methods to make a secure connection to APNs. The first is Certificate-Based Authentication (using a .p12 certificate). The second, newer method is Token-Based Authentication (using a .p8 key).
The table below breaks down the key differences.
Using Token-Based (.p8) vs Certificate-Based (.p12) Authentication to APNs with OneSignal
Authentication Type | Required Fields | Expires? | Easy to use? |
---|---|---|---|
Token-Based (.p8) | - .p8 file - Key ID (10-character string) - Team ID - App Bundle ID (app-specific) | No. | Yes. Tokens can be generated in the Apple Developer panel and then uploaded to OneSignal. |
Certificate-Based (.p12) | - .p12 file - Private Key Password | Yes. Requires renewal in the Apple Developer center once per year. | No. Requires following a precise process to generate valid certificates. |
Next:
Check out our token-based (.p8) or certificate-based (.p12) specific guides to learn how to generate and upload one to your OneSignal account.
Updated almost 2 years ago