FCM getting MismatchSenderId Ask Question

FCM getting MismatchSenderId Ask Question

I have an application that uses Google FCM for sending push notifications.

When i send a push notification to a group of users, i get a response of MismatchSenderId for some of them. Even though, all users have the exact same application. How can some of the users get a success response and others get a MismatchSenderId?

I have researched a lot and made sure I have added all prerequisites that FCM needs.

Any suggestions?

EDIT:

Sample response:

{"multicast_id":5340432438815499122,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]}

EDIT 2:

Here is the server side sending code (PHP):

$fields = array
(
  'to' => $token,
  'data' => $data
);

$headers = array
(
  'Authorization: key=AIza**************************',
  'Content-Type: application/json'
);

$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send' );
curl_setopt( $ch,CURLOPT_POST, true );
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, true );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode($fields) );
curl_exec( $ch );
curl_close( $ch );

UPDATE:

この問題は SDK のアップデートで解決されたようです。現在、最新のものを使用していますがcom.google.firebase:firebase-messaging:9.6.1、「MismatchSenderId」は表示されなくなりました。

ベストアンサー1

Firebase はサーバー キーを新しいバージョンにアップグレードしました。古いキーの代わりに新しいキーを使用してください。

設定->プロジェクト設定->クラウドメッセージングタブに移動します

ここに画像の説明を入力してください

おすすめ記事