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

FR: Support authentication state persistence in Node.js OR document lack of support #1705

Open
carnesen opened this issue Apr 17, 2019 · 2 comments

Comments

@carnesen
Copy link

  • 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. 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

@abdel-ships-it
Copy link

I need auth persistence in node.js for the exact same use case. I have data in firestore that I want to protect with the database rules, is there anyway I can implement this?

@JakeHedman
Copy link

Workaround: #1874 (comment)

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

6 participants