Firebase Error: Auth error from APNS or Web Push Service

后端 未结 3 1595
一整个雨季
一整个雨季 2021-01-11 14:46

After running the following line in node-js:

import * as admin from \"firebase-admin\";
import * as serviceAccount from \"../../firebase_service_account_key.         


        
相关标签:
3条回答
  • 2021-01-11 15:27

    Did you call admin.initializeApp()?

    There are many official samples.

    See:

    • https://github.com/firebase/functions-samples/blob/master/fcm-notifications/functions/index.js#L20
    • https://github.com/firebase/functions-samples/tree/master/fcm-notifications
    • https://github.com/firebase/functions-samples
    • https://github.com/firebase/quickstart-js/tree/master/messaging
    0 讨论(0)
  • 2021-01-11 15:30

    Everything worked for me the other day, so all setup was fine. But today I got this error.

    Here's what solved it for me:

    1. Revoked APNs Key
    2. Created new one and downloaded it
    3. Deleted old one and Uploaded it to Firebase Dashboard / Settings / Cloud Messaging
    4. Gone to Settings / Service Accounts and generated new private key
    5. Added it to my Cloud Functions project (renamed it to service-account.json in my case)
    6. Saved the files and deployed the functions: firebase deploy --only functions
    0 讨论(0)
  • 2021-01-11 15:32

    This error arises if your app setup for iOS has an error in any one of the following:

    Found in Settings > General > Your Apps > iOS Apps:

    • App Store ID
    • Bundle ID
    • Team ID

    When adding an APNs key (Uploading to Cloud Messaging > APNs Authentication Key):

    • Team ID (should auto set based off ios app info above)
    • Key Id (often is in the name of the key, best to grab when creating it)

    0 讨论(0)
提交回复
热议问题