olucurious / PyFCM

Python client for FCM - Firebase Cloud Messaging (Android, iOS and Web)
http://olucurious.github.io/PyFCM/
MIT License
802 stars 204 forks source link

Access token not refreshed in notify #334

Closed Niccari closed 2 months ago

Niccari commented 2 months ago

Access token will not be refreshed. 30 minutes after first API request, got 401 error.

$ gunicorn -w 2 -b :8000 app:app 

# called the notify function once, re-called it after 30 minutes passed

{
  "error": {
    "code": 401,
    "message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
    "status": "UNAUTHENTICATED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "ACCESS_TOKEN_EXPIRED",
        "domain": "googleapis.com",
        "metadata": {
          "method": "google.firebase.fcm.v1.FcmService.SendMessage",
          "service": "fcm.googleapis.com"
        }
      }
    ]
  }
}