Giter Site home page Giter Site logo

If change VAPID keys and in DB already have users registered with other keys, than practically these users are like losts? about web-push-php HOT 6 CLOSED

web-push-libs avatar web-push-libs commented on June 18, 2024
If change VAPID keys and in DB already have users registered with other keys, than practically these users are like losts?

from web-push-php.

Comments (6)

Minishlink avatar Minishlink commented on June 18, 2024 2

Ok, so you can specify a custom auth for each notification with the last parameter of sendNotification:
sendNotification($endpoint, $payload = null, $userPublicKey = null, $userAuthToken = null, $flush = false, $options = array(), $auth = array())

from web-push-php.

Tejas-cloud avatar Tejas-cloud commented on June 18, 2024 2

If you change Vapid keys , then

  1. go to browser setting ,
  2. search notification setting.
  3. check which sites are allowed to send notification,
    4.remove your site . and add your site again.
    so this time browser will give you permission for considering your new vapid keys and you can get notification.
    THis must be done on host browser.

from web-push-php.

Minishlink avatar Minishlink commented on June 18, 2024

Hi, you should not change the VAPID keys ever. That's your identity for browser vendors. It's like forgetting your PGP keys. Thus, the createVapidKeys() function must be called only once in the lifetime of your project.

Now, if you do change the VAPID keys. Next time the user will be on your website, the Javascript API subscription will subscribe your user with the new VAPID public key that you provided, so that either the existing subscription is updated or a new subscription is created (I don't know which behavior but it ends up the same). It is true that until the user goes to your website, the browser's server will not know that your VAPID keys are changed, and thus the user won't receive notifications.

That being said, I reckon that there is still a possibility that people lose their keys, and that push notifications may be critical if it's the entry point of your website... For this use case, I'll implement an option or a setAuth method.

from web-push-php.

yourchoice avatar yourchoice commented on June 18, 2024

10x

from web-push-php.

yourchoice avatar yourchoice commented on June 18, 2024

I will try to keep same vapid keys. But maybe this is a good thing for future if appear new changes regarding auth and need support for old auth.

10x

from web-push-php.

collimarco avatar collimarco commented on June 18, 2024

@Minishlink Your answer is incorrect. If you use different VAPID keys an error will be raised when you visit the website, but unfortunately the VAPID key is not replaced automatically. Some time ago I asked to improve the subscribe method to automatically replace the key, but nothing changed. You can read more here: w3c/push-api#291

from web-push-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.