Description
I am unable to get push notifications working for Catalyst. My current setup works correctly for iOS but shows an authentication error for Catalyst.
Code Excerpts
AppDelegate
FirebaseApp.configure(options: options)
Messaging.messaging().delegate = self
UNUserNotificationCenter.current().delegate = self
func registerForPushNotifications(completionHandler : @escaping () -> Void) {
UNUserNotificationCenter.current().getNotificationSettings() { settings in
guard settings.authorizationStatus == .authorized else { return }
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
iOSNotificationService.shared.getPendingNotifications()
completionHandler()
}
}
}
func requestPushNotificationAuthorization(completionHandler: @escaping ()-> Void ) {
let authOptions : UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(options: authOptions) { (granted, error) in
guard granted else {
if let errorString = error?.localizedDescription {
os_log("Push notification authorization denied : %{public}s", errorString )
}
return
}
self.registerForPushNotifications() {
//
//
}
completionHandler()
}
}
**Error **
{ Error: Auth error from APNS or Web Push Service Raw server response: "{"error":{"code":401,"message":"Auth error from APNS or Web Push Service","status":"UNAUTHENTICATED","details":[{"@type":"type.googleapis.com/google.firebase.fcm.v1.FcmError","errorCode":"THIRD_PARTY_AUTH_ERROR"}]}}"
at FirebaseMessagingError.FirebaseError [as constructor] (/srv/node_modules/firebase-admin/lib/utils/error.js:42:28)
at FirebaseMessagingError.PrefixedFirebaseError [as constructor] (/srv/node_modules/firebase-admin/lib/utils/error.js:88:28)
at new FirebaseMessagingError (/srv/node_modules/firebase-admin/lib/utils/error.js:253:16)
at Function.FirebaseMessagingError.fromServerError (/srv/node_modules/firebase-admin/lib/utils/error.js:283:16)
at Object.createFirebaseError (/srv/node_modules/firebase-admin/lib/messaging/messaging-errors.js:34:47)
at /srv/node_modules/firebase-admin/lib/messaging/messaging-api-request.js:76:42
at
at process._tickDomainCallback (internal/process/next_tick.js:229:7)
errorInfo:
{ code: 'messaging/unknown-error',
message: 'Auth error from APNS or Web Push Service Raw server response: "{"error":{"code":401,"message":"Auth error from APNS or Web Push Service","status":"UNAUTHENTICATED","details":[{"@type":"type.googleapis.com/google.firebase.fcm.v1.FcmError","errorCode":"THIRD_PARTY_AUTH_ERROR"}]}}"' },
codePrefix: 'messaging' }
Configuration
- Using APNS Key
- Happens with both Xcode 11.3.1. & 11.4 Beta
- Mac OS Catalina 10.15.3
- podfile.lock excerpts
- Firebase/Functions (6.18.0):
- Firebase/CoreOnly
- FirebaseFunctions (~> 2.5.1)
- Firebase/Messaging (6.18.0):
- Firebase/CoreOnly
- FirebaseMessaging (~> 4.3.0)
- FirebaseCore (6.6.3):
- FirebaseCoreDiagnostics (> 1.2)> 1.2)
- FirebaseCoreDiagnosticsInterop (
- GoogleUtilities/Environment (> 6.5)> 6.5)
- GoogleUtilities/Logger (
- Firebase/Functions (6.18.0):