push-receiver
push-receiver copied to clipboard
How to copy all the credentials from an Android device to our node server?
I have an another app(not my app) which is running on my phone, and this app's fcm server is sending notifications to my phone. I know the senderId and apiKey of the app and also my phone's pushNotificationId which is set by the app's server.
Can I get the notifications on my node server with this project? I thought I have to copy the credentials that created when the app opened first time and registered to the fcm server of the app to my nodejs push-receiver and start listening with those credentials.
Does it possible to get them from an Android device?
Seems like a great use case !
You'll need all the credentials required by push-receiver
to listen to incoming notifications:
- the
androidId
returned by GCM during registration - the
securityToken
returned by GCM during registration - the
privateKey
to use to decrypt the notifications. The correspondingpublicKey
was sent to FCM during registration. - the
authSecret
which was generated & sent to FCM during registration
I never did that so I don't know how to retrieve these credentials 😕 The heavy part of the registration process is done by the OS not the application.
The registration logic we use in push-receiver was inspired by the registration process in Chrome. You may have to deep dive into Android source code to find what you want.
All I had to do to receive FCM messages from my app (or another app I suppose) was to call register
with my senderId
which is in google-services.json
. This worked like a treat for me.