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

WebPushException Push failed: 403 Forbidden #82

Open
oluwakayode-a opened this issue Jul 7, 2020 · 2 comments
Open

WebPushException Push failed: 403 Forbidden #82

oluwakayode-a opened this issue Jul 7, 2020 · 2 comments

Comments

@oluwakayode-a
Copy link

Hello, I'm facing an issue with using Push Notifications. It worked fine until recently when it started showing this error whenever I tried to send a notification from the admin panel.

Below is the full traceback
`Traceback:

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
34. response = get_response(request)

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
126. response = self.process_exception_by_middleware(e, request)

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
124. response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/django/contrib/admin/options.py" in wrapper
604. return self.admin_site.admin_view(view)(*args, **kwargs)

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapped_view
142. response = view_func(request, *args, **kwargs)

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/django/contrib/admin/sites.py" in inner
223. return view(request, *args, **kwargs)

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/django/contrib/admin/options.py" in change_view
1640. return self.changeform_view(request, object_id, form_url, extra_context)

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapper
45. return bound_method(*args, **kwargs)

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapped_view
142. response = view_func(request, *args, **kwargs)

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/django/contrib/admin/options.py" in changeform_view
1525. return self._changeform_view(request, object_id, form_url, extra_context)

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/django/contrib/admin/options.py" in _changeform_view
1564. self.save_model(request, new_object, form, not add)

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/django/contrib/admin/options.py" in save_model
1091. obj.save()

File "/home/oluwakayode/Mauvelli/blog/models.py" in save
155. super(Post, self).save()

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/django/db/models/base.py" in save
718. force_update=force_update, update_fields=update_fields)

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/django/db/models/base.py" in save_base
758. update_fields=update_fields, raw=raw, using=using,

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/django/dispatch/dispatcher.py" in send
175. for receiver in self._live_receivers(sender)

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/django/dispatch/dispatcher.py" in
175. for receiver in self._live_receivers(sender)

File "/home/oluwakayode/Mauvelli/blog/models.py" in send_push
282. send_group_notification(group_name="subscribers", payload=payload, ttl=1000)

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/webpush/init.py" in send_group_notification
8. send_notification_to_group(group_name, payload, ttl)

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/webpush/utils.py" in send_notification_to_group
22. _send_notification(push_info.subscription, payload, ttl)

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/webpush/utils.py" in _send_notification
54. raise e

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/webpush/utils.py" in _send_notification
46. req = webpush(subscription_info=subscription_data, data=payload, ttl=ttl, **vapid_data)

File "/home/oluwakayode/Mauvelli/env/lib/python3.6/site-packages/pywebpush/init.py" in webpush
437. response=response)

Exception Type: WebPushException at /admin/blog/post/325/change/
Exception Value: WebPushException: Push failed: 403 Forbidden`

@oluwakayode-a oluwakayode-a changed the title WebPushException Push failed: 403 Forbidde WebPushException Push failed: 403 Forbidden Jul 7, 2020
@Rebix
Copy link

Rebix commented Sep 27, 2020

same error here

Traceback (most recent call last):
File "", line 1, in
File "/home/vesta/newVesta/venv/lib/python3.6/site-packages/webpush/init.py", line 13, in send_user_notification
send_notification_to_user(user, payload, ttl)
File "/home/vesta/newVesta/venv/lib/python3.6/site-packages/webpush/utils.py", line 13, in send_notification_to_user
_send_notification(push_info.subscription, payload, ttl)
File "/home/vesta/newVesta/venv/lib/python3.6/site-packages/webpush/utils.py", line 54, in _send_notification
raise e
File "/home/vesta/newVesta/venv/lib/python3.6/site-packages/webpush/utils.py", line 46, in _send_notification
req = webpush(subscription_info=subscription_data, data=payload, ttl=ttl, **vapid_data)
File "/home/vesta/newVesta/venv/lib/python3.6/site-packages/pywebpush/init.py", line 437, in webpush
response=response)
pywebpush.WebPushException: WebPushException: Push failed: 403 Forbidden

@marcuslavender
Copy link

marcuslavender commented Nov 14, 2020

I also have the same error.

Traceback (most recent call last):
File "/todobackend/venv/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/todobackend/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/todobackend/venv/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/todobackend/venv/lib/python3.6/site-packages/django/contrib/admin/options.py", line 607, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
File "/todobackend/venv/lib/python3.6/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/todobackend/venv/lib/python3.6/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/todobackend/venv/lib/python3.6/site-packages/django/contrib/admin/sites.py", line 231, in inner
return view(request, *args, **kwargs)
File "/todobackend/venv/lib/python3.6/site-packages/django/utils/decorators.py", line 43, in _wrapper
return bound_method(*args, **kwargs)
File "/todobackend/venv/lib/python3.6/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/todobackend/venv/lib/python3.6/site-packages/django/contrib/admin/options.py", line 1704, in changelist_view
response = self.response_action(request, queryset=cl.get_queryset(request))
File "/todobackend/venv/lib/python3.6/site-packages/django/contrib/admin/options.py", line 1390, in response_action
response = func(self, request, queryset)
File "/todobackend/venv/lib/python3.6/site-packages/webpush/admin.py", line 16, in send_test_message
notification = _send_notification(device.subscription, json.dumps(payload), 0)
File "/todobackend/venv/lib/python3.6/site-packages/webpush/utils.py", line 54, in _send_notification
raise e
File "/todobackend/venv/lib/python3.6/site-packages/webpush/utils.py", line 46, in _send_notification
req = webpush(subscription_info=subscription_data, data=payload, ttl=ttl, **vapid_data)
File "/todobackend/venv/lib/python3.6/site-packages/pywebpush/init.py", line 437, in webpush
response=response)
pywebpush.WebPushException: WebPushException: Push failed: 403 Forbidden

aud 'https://fcm.googleapis.com'
content_encoding 'aes128gcm'
curl False
data '{"head": "Hey", "body": "Hello World"}'
response <Response [403]>
subscription_info {'endpoint': 'https://fcm.googleapis.com/fcm/send/dmUMuGM-62w:APA91bHefydlagoWtvVE4TQKzobFcENuRpngKmVeWVLpyZlpwcl9xPYRGIizXAXFYWSgZ5IhvVlC5qNW1NUzDT52wZNcqskUeHDuCP2zsi7LsNRjEx7VIckIrqszsoRdyIjGJ72UpsGc', 'keys': {'auth': 'UNMDwcmNne92ztwvZUOhDw', 'p256dh': 'BPSTHbPMsR-KoNbixNT_rhOUrx6x6CHUzR3HAZPBml2__VMnWjGSwRzYNDsdP5kh58FWA9W_TCag9DxIdfuupkY'}}
timeout None
ttl 0
url ParseResult(scheme='https', netloc='fcm.googleapis.com', path='/fcm/send/dmUMuGM-62w:APA91bHefydlagoWtvVE4TQKzobFcENuRpngKmVeWVLpyZlpwcl9xPYRGIizXAXFYWSgZ5IhvVlC5qNW1NUzDT52wZNcqskUeHDuCP2zsi7LsNRjEx7VIckIrqszsoRdyIjGJ72UpsGc', params='', query='', fragment='')
vapid_claims {'aud': 'https://fcm.googleapis.com', 'exp': 1605400287, 'sub': 'mailto:'removed'}
vapid_headers {'Authorization': 'vapid ' 't=eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiJodHRwczovL2ZjbS5nb29nbGVhcGlzLmNvbSIsImV4cCI6MTYwNTQwMDI4Nywic3ViIjoibWFpbHRvOm1sYXZlbmRlckBkdW9zZWN1cml0eS5jb20ifQ.j94wiORAbVdie_o9Kb6DCnnwF6Yyzl-zFDf2F2D8D7q1--jzbp3vLt-Q7k19ljcp2X0HHiUGoRPAV_OJHrJlFg,k=BNtIqefeGELBQ0duVazH_r23IXFepy7qtt4o62Fgy5yNYJovCFFETnRsj-79JSQ8DFGwT2-Htq2C5SBMLJYSXKw'}
vapid_private_key 'removed'
vv <py_vapid.Vapid02 object at 0x7ffad07f94a8>

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

3 participants