dcai / airnotifier

Push Notifications Server for Human Beings.
Other
593 stars 187 forks source link

FCM Error 'SenderId mismatch' #211

Closed waritsan closed 4 years ago

waritsan commented 4 years ago

Hello, I deployed AirNotifier 2.x on AWS EC2. However, I keep getting SenderId mismatch error when submitting a push notification. Could you please help me out?

Request

POST /api/v2/push HTTP/1.1
Host: ec2-3-136-178-22.us-east-2.compute.amazonaws.com:8801
Accept: application/json
X-AN-APP-NAME: notification
X-AN-APP-KEY: dfb5cd6c4aa0c.........

{
    "device": "android-fcm",
    "token": "cxsvc9gzo6U:APA91bEH6MEBwXWUD1210128eiYBGKcJruIbwGzE...........",
    "alert": "Hello from AirNotifier",
    "badge": 1
}

Response

{
    "error": "{'code': 403, 'message': 'SenderId mismatch', 'status': 'PERMISSION_DENIED', 'details': [{'@type': 'type.googleapis.com/google.firebase.fcm.v1.FcmError', 'errorCode': 'SENDER_ID_MISMATCH'}]}"
}

airnotifier.err

[E 191217 04:38:05 fcm:111] {'error': {'code': 403, 'message': 'SenderId mismatch', 'status': 'PERMISSION_DENIED', 'details': [{'@type': 'type.googleapis.com/google.firebase.fcm.v1.FcmError', 'errorCode': 'SENDER_ID_MISMATCH'}]}}
[E 191217 04:38:05 web:2162] 500 POST /api/v2/push (110.170.49.198) 316.67ms

My app settings Screen Shot 2019-12-17 at 11 42 16

config.py

https = False
httpscertfile = "/path/to/ssl/certificate.cert"
httpskeyfile = "/path/to/ssl/server.key"

port = 8801

pemdir = "/var/airnotifier/pemdir"
dcai commented 4 years ago

Hi @waritsan the error comes from google FCM server not airnotifier, it might be the mismatch of reg id and sender id, please read this: https://firebase.google.com/docs/reference/fcm/rest/v1/ErrorCode