Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Documentation] Does getToken consistently return the same token across all tabs (browser session)? #8639

Open
andynewman10 opened this issue Nov 14, 2024 · 2 comments

Comments

@andynewman10
Copy link

andynewman10 commented Nov 14, 2024

Operating System

All

Environment (if applicable)

Chrome

Firebase SDK Version

All

Firebase SDK Product(s)

Messaging

Project Tooling

Plain JavaScript

Detailed Problem Description

I am submitting this issue as a bug related to the documentation because it believe it is important.

On the web, when obtaining an FCM token through the API (getToken), it is unclear, by reading the documentation, if the returned token is guaranteed to be the same for all tabs running the same page, on the same domain. Opening multiple tabs on the same page is a common scenario and nothing in the documentation states whether or not the same token will be returned. The behavior of the code will drastically need to be adapted if different token might be returned.

Note that I am not talking about the fact that the same token may be returned at a later time, eg. if the user closes its browser and then reopens it later.

Steps and code to reproduce issue

  • create a JavaScript web page with Firebase set up and that just gets an FCM token
  • open the same page in a second tab and repeat the process. Compare the returned token IDs. Are they guaranteed to be equal? My understanding is that they are, assuming of course no token refresh event took place before the token was requested the second time. Rationale: all tabs share a single (unique) instance of the service worker, which itself has a token bound to it.
@andynewman10 andynewman10 added new A new issue that hasn't be categoirzed as question, bug or feature request question labels Nov 14, 2024
@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@jbalidiong jbalidiong added api: messaging documentation needs-attention and removed needs-triage new A new issue that hasn't be categoirzed as question, bug or feature request labels Nov 14, 2024
@dlarocque
Copy link
Contributor

Thanks for submitting this issue. If you have a question about Firebase, please see Firebase Support | Ask the Firebase community

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants