ancasimon / travel-diary

This project is an online journal that allows users to keep track of destinations on their bucket list and then capture diary entries when they actually get to visit these sites. It was further practice with using data from multiple collections in a Firebase database.
https://traveldiary-78295.web.app/#
1 stars 0 forks source link

Authorization setup #17

Closed ancasimon closed 4 years ago

ancasimon commented 4 years ago

User Story

As a user, I want to be authenticated to log in to the site with my google email login.

From the exercise instructions:

AC

WHEN I get to the site, THEN I see a page with the heading Check Out My Travel Diary and a Google login button, AND I can log in with my Gmail address, AND WHEN I log in, THEN I see a Home page with the heading Previous and Future Destinations and 2 buttons in the navbar: Home and Log Out, AND When I click Log Out, THEN I get logged out of the site.

Dev Notes

  1. Create a Firebase project (firebase.google.com).

  2. Register your web app: Firebase > On the Project Overview tab for your new project > Click the closing tag icon labeled Web ( </> ) > Don’t worry about the first script - we will use npm firebase install instead; > Just click Continue to Console here. Note: Make sure the Firebase Data > Rules say read and write = true!

  3. Enable google authentication: Firebase project > Authentication tab > Sign-in Method tab > Google option > Change Enable toggle to enable it and add your email in the Project support email field

  4. Now - Do a new git branch for authorization

  5. Create a file for the apiKeys config.  And IMPORTANT!!!: add new apiKeys.json  FILE TO THE > .gitignore file!!! — src/javascripts/helpers/apiKeys.json

  6. Now we have the file > next we need the keys: Add the keys to your project in VSCode

  7. Create an example file for apiKeys: apiKeys.example.json file

  8. In the Index file: Add navbar with Home and Log Out buttons AND Add 2 divs: 1 for the login page and 1 for the home page you see when logged in.

  9. Add a class of .hide in the main.scss file since you will be using it to control which div the user sees when logged in and when logged out

  10. Start building out project files you will need: Component folders and js and sass files for each component ; utils.js file in a helpers file with the printToDom function

  11. Build out the login.js file (this is where the code for the login button will go -add it!!)

  12. Build out the home.js file for the page inside the app - that the user sees once authenticated and logged in

  13. Build out an authData file inside the helpers > data folder that has the function that controls what the user sees.

  14. Add a Google login button

  15. Build out the main.js file, which imports all this data and calls the functions in the init function.