OneSignal exported endpoints cause "VAPID public key mismatch" in Firefox v2 push
I'm encountering problem delivering push notifications to Firefox using endpoints exported from OneSignal database.
- Notifications sent to endpoints beginning with
https://updates.push.services.mozilla.com/wpush/v1/are working correctly. - However, endpoints starting with
https://updates.push.services.mozilla.com/wpush/v2/consistently return a401 Unauthorizederror:
{
"code": 401,
"errno": 109,
"error": "Unauthorized",
"message": "VAPID public key mismatch",
"more_info": "http://autopush.readthedocs.io/en/latest/http.html#error-codes"
}
Sending to Chrome and Edge works fine using the same VAPID key. OneSignal claims the VAPID key is the same.
Tried disabling automatic padding via setAutomaticPadding(false), but it had no effect.
PHP Web Push example works fine with the same Firefox for Windows v142.0.1.
What am I overlooking?
Endpoints with /v1/ are registered without VAPID while /v2/ are registered with VAPID
You probably haven't set correctly the auth param, it fails silently if the auth array doesn't have "VAPID" key
new WebPush(auth: ["VAPID" => ["publicKey" => $pub, "privateKey" => $priv, "subject" => $sub]]);
I did set auth param correctly:
$auth = array(
'VAPID' => array(
'subject' => 'mailto:...',
'publicKey' => '...',
'privateKey' => '...'
),
);
$defaultOptions = [
'urgency' => 'high'
];
$webPush = new WebPush($auth, $defaultOptions);