Closed Tikolu closed 3 years ago
Okay, I managed to find what I was doing wrong. When initialising$webPush
, I was entering all security keys directly, instead of placing them all under a "VAPID" key.
I was entering my security keys like this:
$webPush = new WebPush([
"subject" => "(link to website)",
"publicKey" => $publicKey,
"privateKey" => "(44 character key)"
]);
But I should have entered them like this:
$webPush = new WebPush([
"VAPID" => [
"subject" => "(link to website)",
"publicKey" => $publicKey,
"privateKey" => "(44 character key)"
]
]);
Setup
Problem
Sending a notification to a FCM endpoint does not work. The endpoint sends back a 401 response with the following message:
authorization header must be specified
Expected
The notification would be sent to the endpoint without any errors. According to the usage section of the README, this library supports
fcm.googleapis.com
endpoints for Chrome.Features Used
Example / Reproduce Case
I would greatly appreciate if someone could help me out with this issue, as I've been struggling with it for a few days now. Thank you very much.