firebase / firebase/firebase-admin-java

Handle invalid token responses in FCM

Aperta
#1,064 3 commenti 3 reazioni 0 assegnatari Vedi su GitHub
api: messaging type: feature request
Lingua principale
Java
Stelle
620
Fork
305
Merge medio
3h 23m
PR unite (30g)
1

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia dalla documentazione collegata sulla gestione dei token Firebase e segui come IncomingHttpResponse diventa una FirebaseMessagingException. Confronta le risposte UNREGISTERED e INVALID_ARGUMENT nell’issue, quindi determina come l’implementazione dovrebbe distinguere i token di registrazione non validi dagli altri errori INVALID_ARGUMENT senza basarsi sulle stringhe dei messaggi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
backend-api-design
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.