laravel-notification-channels / webpush

Webpush notifications channel for Laravel.
http://laravel-notification-channels.com
MIT License
670 stars 118 forks source link

403 Forbiden on Apple Safari #181

Closed imrodrigoalves closed 1 year ago

imrodrigoalves commented 1 year ago

Hello, I've been testing implementing this package in a project that implements an SPA and API. It works well until we test on Safari.

The error I receive: POST https://web.push.apple.com/IDENTIFIERresulted in a403 Forbidden` response: {\"reason\":\"BadJwtToken\"}

I've researched into the reasons Apple provide for such here, yet I am not able to find a reason for it not to work :/

// env keys
VAPID_SUBJECT='http://localhost:8080' # Frontend URL for testing Service workers
VAPID_PUBLIC_KEY="MY-PUBLIC-KEY"
VAPID_PRIVATE_KEY="MY-PRIVATE-KEY"

According to a comment with the underlying library it should work without any changes. Read here.

Is someone able to help out?

Regards, Rodrigo

tobias992 commented 1 year ago

We have the same problem and are also looking for a solution.

imrodrigoalves commented 1 year ago

@tobias992 Any luck?

peteruu commented 1 year ago

same problem here.

peteruu commented 1 year ago

i had a problem with this before 'subject' => 'admin@example.com' after 'subject' => 'mailto: admin@example.com'

and also with this before 'topic' => 'new_event', // not defined by default, after 'topic' => 'newEvent', // not defined by default,

I know that topic is not required but anyway.

tobias992 commented 1 year ago

Our problem also was the 'subject' - after change to domain all was working fine.

imrodrigoalves commented 1 year ago

Our problem also was the 'subject' - after change to domain all was working fine.

Can you elaborate on the change that was necessary on your side?

imrodrigoalves commented 1 year ago

Apparently locally it doesn't work. Needs to be a domain with https

peteruu commented 1 year ago

btw guys, how did you resolve 406 error from windows notify server?

duswie commented 1 year ago

Add an env var like:

VAPID_SUBJECT=mailto:xxx@example.de