Closed royalpranjal closed 6 years ago
the aud
is the JWT aud
ience. It's the scheme and location of the URL you're talking to, so for your URL, the aud
would be: https://fcm.googleapis.com
The webpush
method should automatically fill in the aud
from the subscription endpoint info, if you don't specify one in the vapid_claims
. It will also fill in the exp
(or expiration) field.
Is that not happening when you call it?
I was constantly getting exception. After reading through the readme carefully, I didn't fill up the 'aud' field. Still, I got exception that aud is missing in vapid_claims.
Strange. When I use the "--curl" option and look at the middle of the Authorization token, I can see the proper aud injected into the urlsafe base64 data.
If you do want pywebpush to autofill the 'aud', you need to make sure it is not specified and not just blank.
e.g. {"sub": "foo@example.com"} and not {"aud":"", "sub":"foo@example.com"}
Google's errors aren't terribly informative. An Unauthorized error could be due to a missing VAPID field, or using the incorrect private key, or any number of other reasons. Make sure that you have a proper VAPID key pair, and that you use the PUBLIC key when registering and the PRIVATE key when signing the VAPID header. The VAPID key should NOT be the same key you're using to encrypt the body of the message, but I'm guessing you're not doing that if you're calling my library.
On Thu, Jul 6, 2017 at 9:25 AM, Pranjal notifications@github.com wrote:
I was constantly getting exception. After reading through the readme carefully, I didn't fill up the 'aud' field. Still, I got exception that aud is missing in vapid_claims.
Pranjal SinghIndian Institute of Technology Jodhpur+91-7728824252 <+91%2077288%2024252>
On Thu, Jul 6, 2017 at 9:38 PM, JR Conlin notifications@github.com wrote:
the aud is the JWT audience. It's the scheme and location of the URL you're talking to, so for your URL, the aud would be: https://fcm.googleapis.com/
The webpush method should automatically fill in https://github.com/web-push-libs/pywebpush/blob/master/ pywebpush/__init__.py#L295 the aud from the subscription endpoint info, if you don't specify one in the vapid_claims. It will also fill in the exp (or expiration) field.
Is that not happening when you call it?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/web-push-libs/pywebpush/issues/69# issuecomment-313442688, or mute the thread https://github.com/notifications/unsubscribe-auth/ AHlpIKtqAC8uHBl4HrTNG0SpUmJoz8Qfks5sLQaCgaJpZM4OPW6a .
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/web-push-libs/pywebpush/issues/69#issuecomment-313447441, or mute the thread https://github.com/notifications/unsubscribe-auth/AACLq_L1r-7_HQNDbqpeTQgXkGPgCYuwks5sLQqKgaJpZM4OPW6a .
Just to add my grain of salt of this old issue, since it's showing up in Google.
Make sure your endpoint is not None
or ''
, pywebpush won't be able to make the aud
claim by itself and it will throw up an IndexError from py_vapid
.
I am using invalid aud (Getting exception because of this)
Here's my endpoint - https://fcm.googleapis.com/fcm/send/fqMtZMP5GqE:APA91bEKyYNmx83T2_IruAg1olf4zNnyVqL0hpiz8wkVy0ltIxBZ-Dcl4LMg86YBSek9fWhphZIRMqr03G6uonTHF-nyZwypO8JV-sPlDEzjvS9_ce7bGuLYdCnxmhSC6ZYxhFat0sI1
How to find out it's aud?