the-road-to-react-with-firebase / react-firebase-authentication

🔥 Boilerplate Project for Authentication with Firebase in React.
https://www.robinwieruch.de
1.01k stars 296 forks source link

Instructions #5

Closed Khaleel closed 6 years ago

Khaleel commented 6 years ago

Hi

Please can you give complete instructions.

I only have FB credentials in the development object but node is thinking I am in production - all I did was edited firebase.js and placed devConfig data and ran npm start it says:

Failed to compile
./src/firebase/firebase.js
  Line 4:   'YOUR_API_KEY' is not defined                             no-undef
  Line 5:   'YOUR_AUTH_DOMAIN' is not defined                         no-undef
  Line 6:   'YOUR_DATABASE_URL' is not defined                        no-undef
  Line 7:   'YOUR_PROJECT_ID' is not defined                          no-undef
  Line 9:   'YOUR_MESSAGING_SENDER_ID' is not defined                 no-undef
  Line 13:  'AIzaSyCJiwEvXKaIfMHaFbuKuv2ouk7zzkL23E4' is not defined  no-undef
  Line 14:  'YOUR_AUTH_DOMAIN' is not defined                         no-undef
  Line 15:  'YOUR_DATABASE_URL' is not defined                        no-undef
  Line 16:  'YOUR_PROJECT_ID' is not defined                          no-undef
  Line 18:  'YOUR_MESSAGING_SENDER_ID' is not defined                 no-undef

Search for the keywords to learn more about each error.

Thanks so much for this script

rwieruch commented 6 years ago

You have to replace the PLACEHOLDER in src/firebase/firebase.js with your own credentials from Firebase. If you are in production, replace the prodConfig as well.

Khaleel commented 6 years ago

How do I set it in prod or dev mode?

Would this work:

  ? prodConfig
  : devConfig;
rwieruch commented 6 years ago

The firebase.js file already distinguishes between dev and prod config. You only need to fill in the PLACEHOLDER (e.g. YOUR_API_KEY) that you get from the Firebase platform after you have created a new project there. When doing npm start, you will use the devConfig, when doing npm run build, you will get the propConfig.