You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have verified in the issues that my problem hasn't already been resolved
Setup
Please provide the following details, the more info you can provide the
better.
Operating System: Linux
PHP Version: 8.0.3
web-push-php Version: 6.0.5
Please check that you have installed and enabled these PHP extensions :
gmp
mbstring
curl
openssl
Please select any browsers that you are experiencing problems with:
Chrome
Please specify the versions (i.e. Chrome Beta, Firefox Beta etc).
Chrome 89
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
VAPID Support
Sending with Payload
Example / Reproduce Case
useMinishlink\WebPush\WebPush;
useMinishlink\WebPush\Subscription;
$publicKey = "(88 character key)";
$webPush = newWebPush([
"subject" => "(link to website)",
"publicKey" => $publicKey,
"privateKey" => "(44 character key)"
]);
$subscription = Subscription::create([
"endpoint" => "https://fcm.googleapis.com/fcm/send/...",
"publicKey" => $publicKey,
"authToken" => "(24 character key)",
"contentEncoding" => "aes128gcm"
]);
$response = $webPush -> sendOneNotification($subscription);
print_r($response); // -> Client error: `POST (endpoint)` resulted in a `401 Unauthorized` response: authorization header must be specified.
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.
The text was updated successfully, but these errors were encountered:
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 = newWebPush([
"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.
The text was updated successfully, but these errors were encountered: