DEV Community

Discussion on: Building User Accounts with Nuxt, Vuex, and Firebase

Collapse
 
drewclem profile image
Drew Clements

For this, you'd create a .env file and store your keys there. Then you'd setup your nuxt.config.js to use those variables as well.

From there, you'd use process.env.YOUR_KEY where you needed to access the key.

Thread Thread
 
tb_95 profile image
TomBell_95

Thanks for replying, I have been working on this for over a week and seems like this is the only fix so far: stackoverflow.com/questions/703036...

Thread Thread
 
drewclem profile image
Drew Clements

This kind of a gotcha with JAMstack sites and authentication, because at some level, the keys will be exposed somewhere within the compiled code.

However, using the .env and nuxt.config.js route will at least keep them out of the repo.

I haven't built anything with this setup that gets enough traffic to warrant going the extra mile for the extra security.

I don't know of a workaround for this.

Thread Thread
 
tb_95 profile image
TomBell_95

Completely agree, I have been struggling with this for a week and wanted to finish my app with the best practise but from looking at what the community is saying, its a common problem. Thanks mate.