xtrinch / fcm-django-web-demo

Quick demo to demonstrate the use of firebase web push notifications with the use of `javascript` on frontend, `django` on backend and push notifications via `fcm-django` pypi package for django.
74 stars 52 forks source link

Not getting notifications - Config looks different on the front end site? #29

Closed allinws closed 1 year ago

allinws commented 2 years ago

Not getting any notifications, guessing it's because I'ven not set up the config correctly to my firebase account. The config looks different from the one in the project, so not sure on how to implement it. This is what mine look like?

<script type="module">
  // Import the functions you need from the SDKs you need
  import { initializeApp } from "https://www.gstatic.com/firebasejs/9.8.0/firebase-app.js";
  // TODO: Add SDKs for Firebase products that you want to use
  // https://firebase.google.com/docs/web/setup#available-libraries

  // Your web app's Firebase configuration
  const firebaseConfig = {
    apiKey: "xxxx",
    authDomain: "xxx-test.firebaseapp.com",
    projectId: "xxx-test",
    storageBucket: "xxxx-test.appspot.com",
    messagingSenderId: "xxx",
    appId: "xxxx
  };

  // Initialize Firebase
  const app = initializeApp(firebaseConfig);
</script>

EDIT:

So OK I filled out the credentials as you prescribe:

<script src="https://www.gstatic.com/firebasejs/4.1.2/firebase.js"></script>
<script>
const firebaseConfig = {
    apiKey: "xxx",
    authDomain: "xx-test.firebaseapp.com",
    projectId: "xx-test",
    storageBucket: "xx-test.appspot.com",
    messagingSenderId: "xx",
    appId: "xxx"
  };

  firebase.initializeApp(firebaseConfig);
</script>

and then i replaced credentials.json with my own credentials from Firebase. But now when I'm trying to post a test message I get these messages in django admin:

A message failed to send. 1 device was marked as inactive.

Requested entity was not found. (Registration ID/Tokens: xxxx

xtrinch commented 1 year ago

Try deleting device and re-requesting the token