FCM 错误,SENDER_ID_MISMATCH "PERMISSION_DENIED"



我从后端发送推送通知时收到此错误

由com.google.api.client.http.HttpResponseException引起:403禁止{"错误":{"代码":403中,"消息":"SenderId不匹配";,"状态":"PERMISSION_DENIED";,"细节":[{"类型":"type.googleapis.com/google.firebase.fcm.v1.FcmError";,"errorCode":"SENDER_ID_MISMATCH";}]}}`

Message message = Message.builder().setNotification(Notification.builder().setTitle(titulo).setBody(mensaje).build()).setToken(registrationToken).build();
// Send a message to the device corresponding to the provided
// registration token.
try {
String response = FirebaseMessaging.getInstance().send(message);
logger.info("Firebase response: " + response);
} catch (FirebaseMessagingException e) {
logger.error("Error al enviar mensaje de firebase", e);
}

出现此问题的原因可能是用于创建fcm android应用程序的谷歌开发者帐户不是原始开发者帐户。使用谷歌播放创建一个应用程序开发者帐户来创建一个Fcm android应用程序。使用授权的google play开发者帐户创建Fcm android应用程序也是无效的。根据fcm官方网站文件,可能有添加其他发件人的条目,但我没有找到。

这个问题的根本原因是:注册令牌令牌与发件人id不匹配。如果你不是最初的谷歌开发者帐户,你必须找到一种方法来添加一个额外的"发件人";。

最新更新