Giter VIP home page Giter VIP logo

node-authentication's Introduction

Node.js Authentication Project

This project is a Node.js application that provides authentication functionality, including sign up, sign in, sign out, password reset, and Google login/signup.

Live Site

Visit the live site here

Features

  • Sign up with Email: Users can create an account by providing their email and password.
  • Sign In: Users can sign in with their email and password.
  • Sign Out: Users can sign out of their accounts.
  • Reset Password: Users can reset their passwords after signing in.
  • Encrypted Passwords: Passwords stored in the database are encrypted for security.
  • Google Login/Signup: Users can sign in or sign up using their Google accounts.here
  • Forgot Password: Users can reset their passwords via email.
  • Password Strength Validation: Notifications are displayed for unmatching passwords during sign up and incorrect passwords during sign in.
  • reCAPTCHA Integration: Extra points for enabling reCAPTCHA on both sign up and log in pages. here

Environment Variables

To run the application, you need to set the following environment variables in a .env file at the root of your project:

  1. PORT: Specifies the port number the application listens on.
  2. DB_URL: Specifies the MongoDB database URL.
  3. CLIENT_ID: Client ID for Google authentication.
  4. CLIENT_SECRET: Client Secret for Google authentication (sign in with Google).
  5. EMAIL: Email address to send Gmail messages.
  6. PASSWORD: Password for the Gmail account (use Gmail App Password if enabled).
  7. RECAPTCHA_SECRET_KEY: Secret key to use Google reCAPTCHA.
  8. CLIENT_URL: URL to redirect after signing in with Google, e.g., "http://localhost:3000/auth/login/success".

Ensure that you have the appropriate values for each variable before running the application.

Example .env file:

PORT=3000
DB_URL=mongodb://localhost:27017/mydatabase
CLIENT_ID=your_client_id
CLIENT_SECRET=your_client_secret
[email protected]
PASSWORD=your_gmail_password
RECAPTCHA_SECRET_KEY=your_recaptcha_secret_key
CLIENT_URL=http://localhost:3000/auth/login/success

Folder

node-authentication/
├── config/                  # Configuration files
│   └── mongodb.js           # MongoDB configuration
│
├── controllers/             # Controller logic
├── models/                  # Database models
├── routes/                  # Route definitions
├── views/                   # EJS views
├── app.js                   # Express application setup
│
├── public/                  # Static assets
│
├── package.json             # NPM package configuration
├── README.md                # Project README file
├── .gitignore               # Git ignore configuration
└── .env                     # Environment variables file

Installation

To run this project locally, follow these steps:

  1. Clone the repository to your local machine:

    git clone https://github.com/your-username/node-authentication.git
    
  2. Navigate to the project directory:

    cd node-authentication
  3. Install dependencies:

    npm install
    
  4. Start the server:

    npm start
  • Open your web browser and visit http://localhost:3000 to access the application.

Dependencies

  • Express.js
  • MongoDB
  • Passport.js
  • bcrypt
  • express-session
  • express-ejs-layouts
  • dotenv
  • nodemailer

Credits

This project was created by Vivek Yadav

Feel free to contribute by submitting issues or pull requests!

node-authentication's People

Contributors

vivekyadav5750 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.