firebase / firebase/firebase-admin-java

Handle invalid token responses in FCM

オープン
#1,064 コメント 3 件 リアクション 3 件 担当者 0 名 GitHub で見る
api: messaging type: feature request
主要言語
Java
スター
620
フォーク
305
平均マージ
3時間 23分
マージ済み PR(30日)
1

説明

As per the [documentation](https://firebase.google.com/docs/cloud-messaging/manage-tokens#ensuring-registration-token-freshness) a token could be invalid if you have two error codes:

- UNREGISTERED (HTTP 404)
- INVALID_ARGUMENT (HTTP 400)

However INVALID_ARGUMENTS can be caused by other errors.

At the moment we receive the content below from the `IncomingHttpResponse` which is also the error message from the `FirebaseMessagingException`. What we do is to check the string of the message in order to delete these tokens.

```
Content: {
"error": {
"code": 400,
"message": "The registration token is not a valid FCM registration token",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.firebase.fcm.v1.FcmError",
"errorCode": "INVALID_ARGUMENT"
}
]
}
}
```

What is the proper way to handle these errors?
Does it make sense to update FirebaseMessagingException to provide more information about which field is invalid or perhaps have a new error code - INVALID_TOKEN? This would remove a lot of unambiguity as to when it is needed to manage the token.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

リンクされている Firebase トークン管理のドキュメントから始め、IncomingHttpResponse がどのように FirebaseMessagingException になるかを追跡してください。Issue にある UNREGISTERED と INVALID_ARGUMENT のレスポンスを比較し、そのうえで、メッセージ文字列に依存せずに、実装が無効な登録トークンとその他の INVALID_ARGUMENT エラーをどのように区別すべきかを判断してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
backend-api-design
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。