0

I'm trying to implement push notifications to my web-app. Sadly, I'm struggling right in the beginning. While I made a good start with Firefox, Chrome errors "The provided application server key is not a VAPID key. Only VAPID keys will be supported in the future. For more information check https://crbug.com/979235." I tried different keys from different sources. What's wrong with for example this key, generated from https://tools.reactpwa.com/vapid , I use in the code below?

function subscribeUserToPush(reg) {
    return getSWRegistration()
    .then(function(registration) {
        const subscribeOptions = {
            userVisibleOnly: true,
            applicationLocalKey: urlBase64ToUint8Array('BAVR1KZoitVgsfJ8ICyp4XE0H4riw8SRIjr26F4TqM7HUrl5f3clkOMLNu_xZkQB__eJ7f_GRmpdC--BZjqmzcA')
        };
    return registration.pushManager.subscribe(subscribeOptions);
    })
    .then(function(pushSubscription) {
        console.log('Received PushSubscription: ', JSON.stringify(pushSubscription));
        return pushSubscription;
    });
}
neuge
  • 31
  • 1
  • 3

1 Answers1

3

Solved this issue after hours of searching by correcting the wrong option "applicationLocalKey" to the right version "applicationServerKey".

neuge
  • 31
  • 1
  • 3