Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

push notification doesn't work in pyfcm 2.0.2 #333

Closed
almaz1213 opened this issue Jun 19, 2024 · 6 comments
Closed

push notification doesn't work in pyfcm 2.0.2 #333

almaz1213 opened this issue Jun 19, 2024 · 6 comments

Comments

@almaz1213
Copy link

we have error !

steps:

  1. updated pyfcm to 2.0.2
  2. generated new fcmServiceAccKey.json in the Firebase console
  3. our android app got new fcm token for a user

test code on the server side:

from pyfcm import FCMNotification

fcm = FCMNotification(service_account_file=<absolute path to>fcmServiceAccKey.json', project_id='iolmsg-filestore')

res = fcm.notify(<user token from step 3>, 'title', 'text')

print(res)

result:
1

use to use method .notify_single_device but now FCMNotification has no this method

@wkpark
Copy link

wkpark commented Jun 19, 2024

you can check your serviceAccount.json file first.

{
  "type": "service_account",
  "project_id": "XXXX-YYYY",
  "private_key_id": "abced...",
  "private_key": "-----BEGIN PRIVATE KEY-----...",
  ...
}

@almaz1213
Copy link
Author

almaz1213 commented Jun 19, 2024

@wkpark
json generated by farebase console and the json file is valid json format.

how can my checks fix the error?

@wkpark
Copy link

wkpark commented Jun 19, 2024

@wkpark json generated by farebase console and the json file is valid json format.

how can my checks fix the error?

I can confirm that with an invalid fcm_token, I've got the same error as yours.

params_list =  [{'fcm_token': 'aaaa', 'notification_title': 'Hello World', 'notification_body': 'pyfcm 2.0.2 test from development server. thanks'}] # for async_notify_multiple_devices(params_list=params_list) args, or notify(**params_list[0])

[{'error': {'code': 400, 'message': 'The registration token is not a valid FCM registration token', 'status': 'INVALID_ARGUMENT', 'details': [{'@type': 'type.googleapis.com/google.firebase.fcm.v1.FcmError', 'errorCode': 'INVALID_ARGUMENT'}]}}]

@almaz1213
Copy link
Author

almaz1213 commented Jun 20, 2024

  1. on the machine with pyfcm 1.5.4 works fine with the same fcm_token. so, it means the problem is not with fcm_token
  2. from firebase console works also

problem in pyfcm 2.0.2 with the new fcm implementation

@almaz1213
Copy link
Author

almaz1213 commented Jun 21, 2024

i think you should check scopes parameter.....

@almaz1213
Copy link
Author

request using curl response with the same error. so, it's not in pyfcm end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants