-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
[Question]: Best practice when utilizing caching from service worker capabilities #272
Comments
Hey @discoverlance-com, Sounds like a really nice problem to solve! I think you can safely cache
You will most likely need to fetch that idToken using |
Hi, thanks for the reply. Ideally, I don't want to cache any auth resources unless necessary and will have no effect on the functionality of the package or firebase. So yes, per what you have said about the logout api, I think I will go ahead to cache that but I think I will consider not caching the What about api routes like the |
This route is designed to give you the latest valid ID token to communicate with external services. In case of the lack of network connection, it will be called if the token is expired and you're using If you want it still to work when app is offline, you could cache it, but you'll also need to cache external API calls, if you have any.
No, it's only those three. In general, it all depends on what you want to achieve – do you want the login functionality to work offline? It sounds weird, but could be achieved with Service Worker caching. Downside of that is the fact that service worker will keep the credentials, so if the app is offline and Firebase Client SDK calls are also cached, it may help bad actors to log in to the app.
|
Sorry, I might have sent too many alerts. I was not sure of the guide to closing issues so I was a bit unsure whether I am to close it or you will. So I reopened it. At the moment, I have the information I need as a result based on your reply so this case can be closed. |
I am working on an application that heavily uses service workers and caching. I want to know if there's any best practice or any api routes I should look to disable caching on. For my application, I am using a library serwist and it provides some very good fundamentals but I want to consider the api routes and network connections that this package will be making, what to skip caching and which ones should be ok to cache for say an hour.
I am presuming that I should not cache api routes like
/api/login
and/api/logout
but I am not totally sure.I know this might be a bit out of scope of this project but I am not exactly sure which api routes will be ok to cache and which ones will not be so I will really appreciate your help on this. I will also try myself to set up the package with my application and try some caching strategies to see which works but I might miss some important routes/information that will bite me in the foot later so I am hoping this issue will provide some useful insights into how the package works best with service workers and caching.
The text was updated successfully, but these errors were encountered: