Keyserver code is here and here.
This is implemented according to the Detect invalid token responses from the FCM backend section in the Firebase docs.
Unfortunately, for INVALID_ARGUMENT there are no detailed docs of how the error might look like, the only information is a description of each ErrorCode. This is a common issue with Firebase, see e.g. here.
We had two options:
- Invalidate token for all INVALID_ARGUMENT errors - this error could be caused by multiple things e.g., a badly created HTTP request can invalidate the token.
- Check if the error has a message about an invalid registration token (this is a bit experimental).
The returned error looks like this:
{
"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"
}
]
}
}Based on what node SDK is doing on a keyserver this approach is basically the same, so I implemented option 2 but I am open for changing this.
Depends on D12946