web-push-libs / pywebpush

Python Webpush Data encryption library
Mozilla Public License 2.0
303 stars 52 forks source link

How to set the `aud` for localhost #157

Open George3d6 opened 6 months ago

George3d6 commented 6 months ago

Chrome/Chromium require the aud parameter in the vapid claims (403 error asking for it is returned otherwise).

However just setting this to http://localhost:port doesn't seem to work (it's not recognized as a valid aud)

George3d6 commented 6 months ago

Ups, I was mistaken here, the aud is supposed to be the actual push service origin (e.g. https://fcm.googleapis.com for chromium`) -- in this case, should this parameter be automatically extracted from the subcription info being passed?

Could make a PR with this fix if so.

jrconlin commented 6 months ago

we should be extracting the aud from the vapid claims, so long as it's not present (e.g. it's None not an empty string). Is that not working for you?