You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: "Push notifications on iOS are managed and dispatched using Apple’s Push Notification Service. Learn how to use this service with Mattermost."
5
-
date: 2015-05-20T11:35:32-04:00
4
+
description: "Learn how to generate an APNs Auth Key for iOS push notifications."
5
+
date: 2025-09-19T08:44:00+08:00
6
6
weight: 2
7
7
aliases:
8
8
- /contribute/mobile/push-notifications/ios
9
9
---
10
10
11
-
Push notifications on iOS are managed and dispatched using {{< newtabref href="https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html" title="Apple's Push Notification Service" >}}. You must have a **Paid Apple Developer account** to create certificates needed to send notifications using this service.
11
+
## Generate APNs Auth Key
12
12
13
-
- Generate a Certificate from Keychain Access
14
-
- Launch the **Keychain Access application** in your Mac and select **KeyChain Access -\Certificate Assistant -\Request a Certificate From a Certificate Authority...**
- Log in to {{< newtabref href="https://developer.apple.com/account" title="Apple developer account" >}} and click **Certificates, Identifiers and Profiles**
24
-

18
+
### Prerequisites
25
19
26
-
-Select the plus icon to create a new certificate
27
-

20
+
-Apple Developer Program account
21
+
- Registered iOS app Bundle ID with **Push Notifications** capability enabled
28
22
29
-
- Select a new "Apple Push Notifications service SSL (Sandbox & Production)"
30
-

23
+
---
31
24
32
-
- Choose the App ID you're generating a certificate for. Use the regular App ID for the Mattermost app, **not** for the `.NotificationService`, etc.
33
-

25
+
### 1. Create an APNs Auth Key
26
+
27
+
1. Sign in to {{< newtabref href="https://developer.apple.com/account/resources/authkeys/list" title="Apple Developer: Keys" >}}.
28
+
2. Click **+** to register a new key.
29
+

30
+
3.**Enter a Key Name** to easily identify it later (e.g., *Mattermost Push Proxy*).
31
+

32
+
4.**Enable APNs** by checking the **Apple Push Notifications service (APNs)** box and click **Configure** to configure the key.
33
+

34
+
5. On the **Configure Key** screen:
35
+
- Select an **Environment**: *Sandbox*, *Production*, or *Sandbox & Production*.
36
+
- Choose a **Key Restriction**: *Team Scoped (All Topics)* or *Topic Specific*.
- Choose the certificate request file created using the Keychain access in the previous section and select **Continue**.
36
-

51
+
---
37
52
38
-
- Download the Certificate and click **Done** to finish the process
53
+
### 2. Next Steps
39
54
40
-
At this point, you can build the Mattermost app for iOS and use the above downloaded certificate to setup the [Mattermost Push Notification Service]({{< ref "/contribute/more-info/mobile/push-notifications/service" >}}).
55
+
Once you’ve generated your APNs Auth Key and collected the Key ID, Team ID, and Bundle ID, continue to the [Push Notification Service setup]({{< ref "/contribute/more-info/mobile/push-notifications/service" >}}) page to configure the Mattermost Push Notification Service (MPNS).
Copy file name to clipboardExpand all lines: site/content/contribute/more-info/mobile/push-notifications/service.md
+38-68Lines changed: 38 additions & 68 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "Push notification service"
3
3
heading: "Install the Mattermost push notification service"
4
-
description: "This guide focuses on installing and configuring the push notification service for Mattermost apps."
4
+
description: "Learn how to configure the Mattermost Push Notification Service (MPNS) with iOS and Android credentials."
5
5
date: 2015-05-20T11:35:32-04:00
6
6
weight: 3
7
7
aliases:
@@ -12,25 +12,30 @@ Now that the app can receive push notifications, we need to make sure that the M
12
12
13
13
### Requirements
14
14
15
-
- A Linux box server with at least 1GB of memory.
15
+
- A Linux or FreeBSD box server with at least 1GB of memory.
16
16
- A copy of the {{< newtabref href="https://github.com/mattermost/mattermost-push-proxy/releases" title="Mattermost Push Notification Service" >}}.
17
17
-[Custom Android and/or iOS]({{< ref "/contribute/more-info/mobile/build-your-own" >}}) Mattermost mobile apps.
18
-
-Private and public keys obtained from the {{< newtabref href="https://developer.apple.com/account/ios/certificate/" title="Apple Developer Program" >}}.
19
-
- A Firebase Cloud Messaging Server key obtained from the {{< newtabref href="https://console.firebase.google.com" title="Firebase Console" >}}.
18
+
-An APNs Auth Key (`.p8`) obtained by following the [iOS Push Notifications guide]({{< ref "/contribute/more-info/mobile/push-notifications/ios" >}}).
19
+
- A Firebase Cloud Messaging Server key obtained by following the [Android Push Notifications guide]({{< ref "/contribute/more-info/mobile/push-notifications/android" >}}).
20
20
21
21
## Install and upgrade
22
22
23
23
For the sake of making this guide simple we located the files at `/home/ubuntu/mattermost-push-proxy`. We've also elected to run the Push Notification Service as the `ubuntu` account for simplicity. We **recommend** setting up and running the service under a `mattermost-push-proxy` user account with limited permissions.
24
24
25
-
1. Download the Mattermost Push Notification Service (any version):
25
+
1. Download the latest Mattermost Push Notification Service:
26
26
27
-
`wget https://github.com/mattermost/mattermost-push-proxy/releases/download/vX.X.X/mattermost-push-proxy.tar.gz` (`mattermost-push-proxy-X.X.X.tar.gz` for releases earlier than v5.9)
In this command, `vX.X.X` refers to the release version you want to download. See {{< newtabref href="https://github.com/mattermost/mattermost-push-proxy/releases" title="Mattermost Push Notification Service releases" >}}.
30
32
31
33
2. If you're upgrading a previous version of the Mattermost Push Notification Service make sure to back up your `mattermost-push-proxy.json` file before continuing.
32
34
33
-
3. Unzip the downloaded Mattermost Push Notification Service using: `tar -xvzf mattermost-push-proxy.tar.gz`
35
+
3. Unzip the downloaded Mattermost Push Notification Service using:
4. Configure the Mattermost Push Notification service by editing the `mattermost-push-proxy.json` file at `/home/ubuntu/mattermost-push-proxy/config`. Follow the steps in the [Android](#set-up-mattermost-push-notification-service-to-send-android-push-notifications)
36
41
and [iOS](#set-up-mattermost-push-notification-service-to-send-ios-push-notifications) sections to replace the values in the config file.
@@ -69,39 +74,32 @@ For the sake of making this guide simple we located the files at `/home/ubuntu/m
69
74
70
75
### Set up Mattermost push notification service to send iOS push notifications
71
76
72
-
- Double click the **Push Notifications Certificate** which is generated and downloaded while [Setting up Push Notifications for iOS]({{< ref "/contribute/more-info/mobile/push-notifications/ios" >}}) to add it to your Keychain Access. It downloads by default as `aps.cer`.
73
-
74
-
- Open **Keychain Access**, select the **login** keychain and **My Certificates** from the side menu.
75
-

76
-
77
-
- Find the certificate you imported and then right click to **export** it as a **.p12** file
78
-

79
-
80
-
- Enter a name for the filename and click **Save**
- Copy the private key file `aps_production_priv.pem` into your `mattermost-push-proxy/config` directory
99
-
100
-
- Open the **mattermost-push-proxy.json** file under the `mattermost-push-proxy/config` directory and add the path to the private key file as the value for **"ApplePushCertPrivate"** and the value for **"ApplePushTopic"** with your *Bundle Identifier*
101
-
102
-

77
+
Instead of certificates, we now recommend using an **APNs Auth Key (`.p8`)** to authenticate with Apple Push Notification service (APNs).
78
+
If you haven’t generated your key yet, see [Generate an APNs Auth Key]({{< ref "/contribute/more-info/mobile/push-notifications/ios" >}}).
79
+
80
+
- Open the **mattermost-push-proxy.json** file under the `mattermost-push-proxy/config` directory and configure it with your key details:
- **ApplePushTopic**: Your app’s bundle ID (APNs topic).
95
+
- **AppleAuthKeyFile**: Path to the `.p8` file.
96
+
- **AppleAuthKeyID**: Key ID from Apple Developer portal.
97
+
- **AppleTeamID**: Team ID from Apple Developer Membership.
98
+
- **ApplePushUseDevelopment**: `true` for sandbox APNs, `false` for production.
103
99
104
-
In the {{< newtabref href="https://github.com/mattermost/mattermost-push-proxy/tree/master/cmd/renew_apple_cert" title="mattermost-push-proxy project" >}} there are some scripts to ease the process involved for updating the iOS notification certificates. Please check the README.md for further details.
100
+
{{% note %}}
101
+
If you are migrating from certificate-based authentication, you can remove the `ApplePushCertPrivate` field and replace it with the new `AppleAuthKeyFile`, `AppleAuthKeyID`, and `AppleTeamID` values.
102
+
{{% /note %}}
105
103
106
104
### Configure the Mattermost Server to use the Mattermost push notification service
107
105
@@ -162,39 +160,11 @@ Note that device IDs can change somewhat frequently, as they are tied to a devic
162
160
163
161
### Troubleshooting
164
162
165
-
##### High Sierra Apple Developer keys
166
-
167
-
Follow these instructions if you run into an error like below:
168
-
```
169
-
2018/04/13 12:39:24 CRIT Failed to load the apple pem cert err=failed to parse PKCS1 private key for type=apple_rn
170
-
panic: Failed to load the apple pem cert err=failed to parse PKCS1 private key for type=apple_rn
171
-
```
172
-
173
-
1. Follow the directions at {{< newtabref href="https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/DistributingEnterpriseProgramApps/DistributingEnterpriseProgramApps.html#//apple_ref/doc/uid/TP40012582-CH33-SW4" title="developer.apple.com">}} to generate an Apple Push Notification service SSL Certificate, this should give you an `aps_production.cer`
174
-
2. Convert the certificate format to .pem:
175
-
- `openssl x509 -in aps.cer -inform DER -out aps_production.pem`
176
-
3. Double click `aps_production.cer` to install it into the keychain tool
177
-
4. Right click the private cert in keychain access and export to .p12
178
-
5. Extract the private key from the certificate into an intermediate state:
**For iOS / Apple Push Notifications**: If the logs are reflecting DeviceTokenNotForTopic (error 400) this may be because you're using an older / previous Device ID. Re-run the queries you need to get device IDs and test.
192
166
193
-
This could also be because you generated a certificate for the wrong bundle ID. The bundle ID used in `mattermost-push-proxy.json` should be the same one as the app, and should be for the same app it was generated for.
194
-
195
-
##### *TLS: Unknown Certificate Authority* error
196
-
197
-
**For iOS / Apple Push Notifications**: If you see a message in the push proxy log that includes `tls: unknown certificate authority` for iOS devices, it's likely Apple has invalidated your client certificate, or you're using a client certificate without {{< newtabref href="https://developer.apple.com/news/?id=7gx0a2lp" title="the correct certificate authority." >}} To resolve this, follow [these instructions to generate a new certificate]({{< ref "/contribute/more-info/mobile/push-notifications/ios" >}}), and then [upload it to your push proxy server](#set-up-mattermost-push-notification-service-to-send-ios-push-notifications).
167
+
This could also be because you generated a key for the wrong bundle ID. The bundle ID used in `mattermost-push-proxy.json` should be the same one as the app, and should be for the same app it was generated for.
0 commit comments