Skip to content

APNs Authentication Key's Not working for GCM iOS app configuration #4042

Description

@Andreas409

[REQUIRED] Step 2: Describe your environment

  • Xcode version: Version 11.0 (11A420a)
  • Firebase SDK version:
  • Firebase Component: Messaging
  • Component version:
    Firebase/Core (6.10.0):
    • Firebase/CoreOnly
    • FirebaseAnalytics (= 6.1.3)
  • Firebase/CoreOnly (6.10.0):
    • FirebaseCore (= 6.3.1)
  • Firebase/Messaging (6.10.0):
    • Firebase/CoreOnly
    • FirebaseMessaging (~> 4.1.6)
  • FirebaseAnalytics (6.1.3):
    • FirebaseCore (~> 6.3)
    • FirebaseInstanceID (~> 4.2)

[REQUIRED] Step 3: Describe the problem

Any newly added app on a Firebase project, would only work if we used Prod and Sandbox APNs certificates in the iOS app configuration for Cloud Messaging.

Our APNs Authentication Key (even though it is valid and works on multiple other projects), would not work.

Steps to reproduce:

We had to migrate App A, B, C from Project 1 to Project 2. App A, B & C on project 1 all were using the APNs Authentication Key with success (were linked a few weeks back).

Yesterday we removed App A,B,C from Project 1 and added them on Project 2 and used the APNs Authentication Key for the Cloud Messaging.

We kept on getting:

{ 
"@type": "type.googleapis.com/google.firebase.fcm.v1.ApnsError", 
"statusCode": 403, 
"reason": "InvalidProviderToken"
 }

In pure desperation and frustration after trying a million things, we created a brand new project (Xcode & Firebase) and used that same APNs Key. Same error. I then moved App A back onto Project 1 (APNs Key was automatically linked when the app ID was added) and boom notifications worked again.

As a last resort we tried with manually created certificates (Old way), and suddenly everything worked. And this has been verified on App A, B & C on Project 2 as well as the Test Project.

With all of the above we sent push notifications as follows:

We have for App A, B & C iOS and Android equivalents. Android was never affected by any of this. Throughout all of this we tried to send push notifications to specific Device Id's and topics using the Firebase Admin SDK code & Bearer tokens generated from the Private Service Account Key. We also tried through the Firebase Cloud Messaging console.

The Full error response is what we got for the device Id targeted pushes:

{
  "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"
      },
      {
        "@type": "type.googleapis.com/google.firebase.fcm.v1.ApnsError",
        "statusCode": 403,
        "reason": "InvalidProviderToken"
      }
    ]
  }
}

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions