Firebase消息传递/不匹配的凭证 [英] Firebase messaging/mismatched-credential

查看:76
本文介绍了Firebase消息传递/不匹配的凭证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将通知发送到具有Firebase的特定设备,但出现以下错误:

I'm trying to send notifications to a specific device with Firebase but am getting the following error:

{"r":{结果":[{错误":{代码":消息/不匹配的凭据",消息":用于验证此SDK的凭据无权发送消息到与提供的注册令牌相对应的设备.请确保凭据和注册令牌都属于同一个Firebase项目.}}]," canonicalRegistrationTokenCount:0," failureCount:1," successCount:0," multicastId:5165415028752234000}}

{"r": {"results":[{"error":{"code":"messaging/mismatched-credential","message":"The credential used to authenticate this SDK does not have permission to send messages to the device corresponding to the provided registration token. Make sure the credential and registration token both belong to the same Firebase project."}}],"canonicalRegistrationTokenCount":0,"failureCount":1,"successCount":0,"multicastId":5165415028752234000}}

我不确定是什么原因造成的,我正在使用与项目关联的服务帐户以及正确的设备ID.

I'm not sure what is causing this, I'm using the service account associated with the project and the proper device id.

任何帮助都会很棒,谢谢!

Any help would be great, thanks!

推荐答案

问题出在我的google-services.json上.我的应用程序使用两个项目,并且默认使用第一个项目.添加第二个项目json文件最终解决了该问题,因为它现在可以将令牌发送到适当的项目.

The issue was with my google-services.json. My app uses two projects and was defaulting to the first project. Adding the second project json file ended up fixing this since it can now send the tokens to the proper project.

这篇关于Firebase消息传递/不匹配的凭证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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