Firebase错误:来自APNS或Web推送服务的身份验证错误 [英] Firebase Error: Auth error from APNS or Web Push Service

查看:553
本文介绍了Firebase错误:来自APNS或Web推送服务的身份验证错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在node-js中运行以下行之后:

After running the following line in node-js:

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

const app = admin.initializeApp({
  credential: admin.credential.cert(serviceAccount as any),
  databaseURL: "https://my-app-path.firebaseio.com"
});

admin.messaging().send({
    token: "known-good-token",
    notification: {
        title: "Test Push Note",
        body: "Here is some text"
    }
});

我遇到了错误:

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

我在Firebase的设置">云消息"部分下的ios项目中添加了"APNs身份验证密钥".我还正确下载并导入了我的服务帐户json文件.

I've added an "APNs Authentication Key" to my ios project under the Settings > Cloud Messaging section of Firebase. I've also properly downloaded and imported my service account json file.

在研究方面,我尝试查找错误.

In terms of research, I've tried looking up the errors.

  • 对于InvalidProviderToken错误,

  • For the InvalidProviderToken error, this answer seems to indicate I'm using an old token. This is totally possible, but the logs on my app and database appear to match, so it seems off.

对于THIRD_PARTY_AUTH_ERROR,Google没有给我任何点击.我找到的最接近的东西是,以下文本可能成为罪魁祸首(这不是问题):

As for the THIRD_PARTY_AUTH_ERROR, google gave me no hits. The closest thing I found was this, and the following text might be the culprit ( it's not the issue):

auth/unauthorized-domain

auth/unauthorized-domain

如果应用程序域未获得Firebase项目的OAuth操作的授权,则抛出该错误.从Firebase控制台编辑授权域的列表.

Thrown if the app domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.

是否有人对此错误有更多的详细信息,这可能有助于我深入了解此错误?

推荐答案

如果您的iOS应用设置在以下任意一项中存在错误,则会出现此错误:

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

在设置">常规">您的应用">"iOS应用"中找到:

  • 应用商店ID
  • 捆绑ID
  • 团队ID

添加APNs密钥时(上传到云消息> APNs身份验证密钥):

  • 团队ID(应该根据上面的ios应用信息自动设置)
  • 密钥ID(通常是密钥的名称,创建时最好抓住它)

这篇关于Firebase错误:来自APNS或Web推送服务的身份验证错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆