firebase / firebase/firebase-js-sdk
FR: Support authentication state persistence in Node.js OR document lack of support
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 37
Description
* Operating System version: N/A
* Browser version: N/A
* Firebase SDK version: 5.9.4
* Firebase Product: auth
I'm building a userland Node.js command-line interface (CLI) using Firebase for authentication. I want to avoid making the user type their password every time they run a command. Instead, I want to implement a "login" flow that persists a credential to the filesystem that can be used for subsequent password-less authentication until the user "logs out". That is to say I want to use this library's ["Authentication State Persistence" feature](https://firebase.google.com/docs/auth/web/auth-state-persistence). By my reading of those docs, this feature does EXACTLY what I need. The docs say, "The default for web browser and React Native apps is `'local'` (provided the browser supports this storage mechanism, eg. 3rd party cookies/data are enabled) whereas it is `'none'` for Node.js backend apps." The statement "the default is `'none'` for Node.js" led me to believe that I could enable the persistence feature on Node.js though it's not the default setting. Alas, calling `setPersistence` in Node.js with`'local' | 'session'` raises a `'auth/unsupported-persistence-type'` error, "The current environment does not support the specified persistence type."
This issue requests that either a non-`'none'` persistence mode be supported by this library or that the documentation be updated to more clearly indicate the absence of feature support in Node.js along with some information on how to implement that feature "on my own".
Related: https://stackoverflow.com/questions/55716608/persist-firebase-user-for-node-js-client-application
Contributor guide
Assessment
This issue has not been assessed yet.