JAndrew13 / SecretsApp

A web application for posting anonymous messages. This project centered around 7 different levels of security and authentication using hashing, cookies, Google & Facebook OAuth, and more.

Home Page:https://secrets.jakebrunner.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Secrets App stable

About

The Secrets App is a website that allows you to share a personal secret anonymously alongside others on the secrets board. Starting with account creation, new users can enter details manually or login using the Google OAuth2 method. From there, The data is sent to a secure MongoDB Atlas database. Here, user accounts are stored alongside any other potential profile information, as well as the secrets created by this user.

Being centered around web security and authentication methods, over the course of the development process I learned and implemented 6 different types of security layers. Though it is quite simple, it taught me invaluable lessons on why and how to include security in my future projects - starting with basic user registration, and ending with Google OAuth2 connections. Below is a breakdown of each of the successive security techniques.

have a look at the live project

Layer 1: User Registration and login

Allow users to create an account name and password stored in a local database

Layer 2: Database Encryption

Require basic encryption on all password data stored in the database

Layer 3: Hashing Passwords

Apply Hashing to the encrypted passwords stored in the database

Layer 4: Salting and Hashing Passwords

Include 10 rounds of salting/hashing on the encrypted passwords

Layer 5: Enable Cookies and Sessions

Add Cookies and Sessions to the browser using Passport.JS

Layer 6: Enable Google OAuth2 Login

Connect a Google OAuth2 login button to the signup/login page.

Table of contents

Prerequisites

Installation

  1. clone the repository to your desired location.
  2. Install the required packages in the terminal $ npm install

Google API Setup

  1. Head over to Google's Developer Console
  2. Create a new project name "Secrets".
  3. Navigate to the Credentials tab, enter your email, then click save.
  4. click "Create Credentials", then select OAuth Client ID
  5. Select "Web Application" and enter the name "Secrets".
  6. Under Authorized Javascript Origins, enter http://localhost:3000
  7. Under Authorized Redirect URLS, enter http://localhost:3000/auth/google/secrets
  8. Click submit, then save the provided client ID and client secret

Environment Setup

  1. Inside the root project directory, create a new file called .env
  2. open this file with any code editor and add the following text. CLIENT_ID=(your client ID) CLIENT_SECRET=(your client secret)
  3. save the file

Starting The App

To run the website as is, start the app from your terminal with, $node app.js

In you browser's address bar, navigate to http://http://localhost:3000/

Enabling Database Controls

To enable the MongoDB controls on your local machine, you will need to install and configure MongoDB on you local machine before running the application. Once you have done that, go ahead and run the application normally.

Once you have the node server running successfully, the app.js file will have created a new database on your local machine. Check to see that this MongoDB server is running properly.

  1. In a separate command terminal, open the mongo shell. $ mongosh

  2. show the current list of active databases $ show dbs

  3. Here you can control the stored users in "UserDB", or delete the database entirely using standard MongoDB commands. Check out the documentation for more info!

(back to top)

Usage

Once you've successfully got the web-app up and running, you can either manually register a new account on the homepage, or login using your google account with Google OAuth. For manual logins, the data is sent and stored on your local Mongo Database.

After logging in, you are taken to the "secrets" page. This page displays secret messages created by all users. Each user is allowed only one secret at a time (so make sure its a good one!)

(back to top)

Directory

Contains the main app.js file, as well as .env variables for the google API

Folder containing CSS style sheet linked to the HTML document

Contains all pages and components used in the website

(back to top)

Contact

Jake Brunner - jbbrunner10@gmail.com

LinkedIn - https://www.linkedin.com/in/jake-brunner-21760522b/

This Repository - https://github.com/jandrew13/Web-Dev-Bootcamp

(back to top)

Acknowledgments

(back to top)

About

A web application for posting anonymous messages. This project centered around 7 different levels of security and authentication using hashing, cookies, Google & Facebook OAuth, and more.

https://secrets.jakebrunner.com


Languages

Language:JavaScript 50.3%Language:EJS 47.6%Language:CSS 2.1%