Skip to content

Firebase Cloud Messaging token sometimes invalid #821

Description

@fanesz

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

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:

-

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions