Skip to content

arbiminanda/secret-auth-apps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Secrets: Fullstack Express Authentication Apps

This is fullstack express project to implement general and google authentication

Run Script

  • Open terminal/cmd, go to the project directory and install all dependencies
npm install
  • Setup MongoDB server on your device, you can use this as reference
  • Create a database with name "secret_auth_apps", create a collection with name "users"
  • This project use Passport Google Authentication for google auth mechanism, for this purpose you should setup google console API for authentication:
  1. Add project in Google Console API
  2. Setup OAuth Consent Screen
  3. Create OAuth clientID in credentials section, you should set type to web application, input base url of your apps, and set url for google authorization callback
{baseUrl}/auth/google/secrets
  1. You will get clientId and clientSecret
  • Copy file .env.example to .env, and edit the content of that file:
BASE_URL: Base url of your apps
SECRET_KEY: random string for encryption in general authentication purpose
CLIENT_ID: clientId from Google Console API
CLIENT_SECRET: clientSecret from Google Console API
  • Run this command to run the server:
nodemon server.js