-
Notifications
You must be signed in to change notification settings - Fork 54
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
403 MismatchSenderId #100
Comments
Hmm. It's using Google's GCM version of WebPush so there are a few extra variables for the problem. "SenderID" comes from GCM and usually is the registered ID for the Cloud application. IIRC, chrome provides a specific key based on the application that you use for the VAPID generation. I'm not 100% sure, but it may be that either the key you're using isn't the one that matches what Google thinks it should be, and it's telling you that the "SenderID" is failing. I've not messed with Chrome's FCM system in a while so I don't know if things have changed internally. |
Thanks for the quick reply. So does pywebpush not support chrome browsers? Or am I just using it incorrectly? The interesting part is that it works in javascript with the same data... |
It did the last time I checked, and I just re-ran a quick test script which
accepted the chrome push message using my private key.
I do note that there are some warnings from the EC library, but those
didn't seem to impact the send. Guess I need to update that code.
Looks like I was wrong about Google generating the VAPID private key, but
there are a few things you should watch for. I did find
https://developers.google.com/web/fundamentals/push-notifications/common-issues-and-reporting-bugs#authorization_issues
which notes a few things that could cause the 401 message you're seeing,
including mis-matched keys (which you said you already ruled out), an
invalid expiration date for the JWT (I've seen this happen if you specify
exactly 24 hours and your clock is off, try specifying an "exp" that is
something more like `str(int(time.time()) + 43200)` That just means you'll
have to use a new VAPID header every 12 hours instead of re-using the same
one for an entire day. Or you could just generate a new VAPID header for
each request and give it an EXP of time + 300 or something.)
At least that's a few more items you can check to see if they fix your
problem.
…On Thu, Jan 24, 2019 at 3:47 AM Alan Höng ***@***.***> wrote:
Thanks for the quick reply. So does pywebpush not support chrome browsers?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#100 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AACLq8Ue92ExGFnAwF-P79v_csAAuVu9ks5vGZ1JgaJpZM4aPyX4>
.
|
Hi, I have the issue too (when used by Home Assistant) Strange thing is it sometime works and I'm not still able to find out what is the change. |
@jedi7 Are you getting the same 403 "MismatchSenderId" error? If so, that's really odd. Normally the SenderID shouldn't change for a given project, and is encoded in the endpoint URL that you've gotten. It is possible for the WebPush system to tell your app that the subscription info has changed (see the pushsubscriptionchange event, but I would hope it wouldn't be every few hours, and would require your client app (like the Home Assistant UI or whatever you used to get the original subscription info) to get the update and re-subscribe. |
I'm getting just 403. (I'm using FCM vapid) See bellow: About the event, thanks I will add it to my js script. But this will not be the issue. Because when I manually unsubscribe and subscribe, then it does not work. In other words it works only some time. subscription:
req headers: {'Authorization': 'WebPush eyJ0eXAiOi...', 'Crypto-Key': 'p256ecdsa=BN...'}_ response:
|
Interesting thing is. I just restarted the Home Assistant (which uses the pywebpush) and webpush started working. |
pywebpush shouldn't be doing any sort of storage or caching, so I'm a bit at a loss to know why it stopped working, and then started again. I know I'm probably grasping at straws, but I wonder if it might be a clock issue on the HomeAssistant box? If you're letting pywebpush generate the vapid header, if the clock is off that could cause the header to become invalid. If you can get a failure, could you email me (jrconlin@gmail) the output of a |
I just added some more debug logs and restarted HA. Now it is working, so I must wait some time to see the errors. |
There was no change between these two push (only time) ==Working==
==Nonworking (403)==
==creating jwt token=== After reboot of HomeAssistent then it started working again. |
HA! I found it ! I propose to make local copy of vapid_claims in webpush and then modify it. |
Looks like it is all related; home-assistant/core#23613 |
@jedi7 Ah, I think I see the bug. This is one of those python things that bites me every so often, isn't it? The one where passed structures are silently mutable. I'll also add a patch to check and update the |
How to update the 'exp' ? |
32e3fd9#diff-4896b0495b0608d9fbf022a4ed0acc7cR413 May want to check your local clock. |
Any idea how to solve or debug this error? I'm using the latest version from master.
https://stackoverflow.com/questions/53875035/how-to-fix-403-mismatchsenderid-when-sending-web-push-notifications
I get the following traceback:
The text was updated successfully, but these errors were encountered: