firebase / firebase/quickstart-js

Firebase Cloud Messaging token sometimes invalid

Open
#821 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
5.4k
Forks
3.7k
Avg merge
2d 13h
Merged PRs (30d)
6

Description

### Step 1: Describe your environment

* Operating system: Android/Windows
* Browser: MSEdge/Chrome
* Firebase SDK version: firebase_messaging: ^14.7.10 / firebase_core: ^2.24.2

### Step 2: Describe the problem:
I have restful backend app with auth system, where when user log-in,
backend will validate the fcm by fetch with POST method to `https://fcm.googleapis.com/fcm/send`
With payload like this:
`{ "registration_ids": [ "fcm_token..." ] }`

The problem is, sometime it return failure status 1 on first check, but on second/third check, it return succes status 1.

![image](https://github.com/user-attachments/assets/797e43a4-1416-43ec-ae95-1ff2e9c7af74)

#### Steps to reproduce:

1. Get the fcm token from android app (flutter)
2. Fetch with POST method to https://fcm.googleapis.com/fcm/send with payload: `{ "registration_ids": [ "fcm_token..." ] }` (with backend or postman, doesn't matter)
3. Randomly return failure status: 1

#### Observed Results:

I have no idea why is this happen, but mostly happen on first validate (when the token is not validated for a while).
It also happen when I spam fetch it, it give a failure result around 1/10.

#### Expected Results:

Not return failure status=1 because the token is still valid

#### Relevant Code:

```
-
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.