firebase-js-sdk icon indicating copy to clipboard operation
firebase-js-sdk copied to clipboard

Problem of refresh token on iOS (PWA)

Open Droppix opened this issue 1 year ago • 3 comments

Operating System

iOS 16.4

Browser Version

Safari/604/1

Firebase SDK Version

10.7.2

Firebase SDK Product:

Messaging

Describe your project's tooling

App must confirm our backend (after to receive notification with data)

Describe the problem

When the application has obtained a token (getToken), it submits it to the backend, but this token has a limited lifespan, and when the application is running in the background (on iOS), it's possible that the messaging application's token is no longer good, and unfortunately the server won't be able to send a notification to the application until the application has returned to foreground to renew its token via getToken.

How can I refresh the token while the application is running in backround?

Thanks

Steps and code to reproduce issue

 async getToken() {
        const messaging = getMessaging()
        let token = await getToken(messaging, {
            vapidKey: VAPID_PUBLIC_KEY,
        })

        return token
    }

Droppix avatar Feb 07 '24 14:02 Droppix

I am experiencing the exact same problem! Can this please be fixed? Using iOS 17.1.1

JVijverberg97 avatar Feb 12 '24 14:02 JVijverberg97