Module django_push_notifications does not work
I've previously used Django Push Notifications with FCM, and it worked well. However, after Firebase changed its authentication process, it stopped functioning.
What I've Tried Migrated to HTTP v1 API: I updated to the HTTP protocol as described in the django-push-notifications documentation. Updated the Module: Upgraded django-push-notifications to version 3.1.0. Unfortunately, it still doesn't work.
Debugging Steps
- Suspecting an issue with authentication, I implemented a plain Firebase example (using firebase-admin) and confirmed that it worked correctly.
- Through further experiments, I found that supplying my own messaging.Message object resolves the issue.
Here's the code that works: `
message = messaging.Message(
notification=messaging.Notification(
title=title,
body=body,
),
data=data,
)
`
The problem arises when I use the examples provided in the module's documentation, such as:
fcm_device.send_message("This is a enriched message", title="Notification title", badge=6)
This does not work.
Upon inspecting the source code of the module, I noticed:
When creating the Message object, the Notification argument is not used internally. It seems the module doesn't construct the messaging.Notification correctly, leading to the failure.
Question I'd prefer not to manually construct the Message object and rely on the module as intended. Does this module currently work for you? Or do you know of any workarounds or fixes that align with the updated Firebase authentication and messaging API?