I faced to a error from web-push library in my nodejs backend app. When I want to set public key and private key in web-push with webpush.setVapidDetails() I received an error in my terminal that said: "Error: Vapid public key must be a URL safe Base 64" Please help me to fix it.
webpush.setVapidDetails(
"mailto:[email protected]",
process.env.VAPID_PUBLIC_KEY,
process.env.VAPID_PRIVATE_KEY
);
and I tried to use some different ways for example:
const publicKey = base64url.toBase64(process.env.VAPID_PUBLIC_KEY);
const privateKey = base64url.toBase64(process.env.VAPID_PRIVATE_KEY);
but it doesn't work.