firebase / firebase/firebase-admin-java
Handle invalid token responses in FCM
- Ngôn ngữ chính
- Java
- Star
- 620
- Fork
- 305
- Merge trung bình
- 3 giờ 23 phút
- Pull request đã merge (30 ngày)
- 1
Mô tả
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.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với tài liệu quản lý token Firebase được liên kết và lần theo cách IncomingHttpResponse trở thành một FirebaseMessagingException. So sánh các phản hồi UNREGISTERED và INVALID_ARGUMENT trong issue, sau đó xác định cách phần triển khai nên phân biệt các token đăng ký không hợp lệ với các lỗi INVALID_ARGUMENT khác mà không dựa vào các chuỗi thông báo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- backend-api-design
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 30/100