Giter Site home page Giter Site logo

auth-service's Introduction

DFS Auth Service

Description

DFS Auth Service is a centralized, secure authentication service for all DFS projects, ensuring seamless access and enhanced security

Usage Documentation

You can visit the following pages to read the documentation of the APIs

Installation and Setup DFS-Auth

To install DFS-Auth, follow these steps:

Clone the repository

git clone [email protected]:shaantanu314/DFS_Auth-Service.git

Install npm packages

Install all the npm packages

npm i

Setting up

Create a .env and copy the content of .env.example

cp .env.example .env

Setup mailing creds for nodemailer. We use google OAuth2 credentials to authorize the nodemailer client to send mails on behalf of us.

Visit the youtube video linked below to setup your google account to generate these four keys which will be added in .env

GOOGLE_USER_EMAIL = "[email protected]"
GOOGLE_CLIENT_ID = "XXXX"
GOOGLE_CLIENT_SECRET = "XXXX"
GOOGLE_REFRESH_TOKEN = "XXXX"

IMAGE ALT TEXT HERE

Setup mysql

Database and User creation

# Login to your `sql` cli using sudo account
mysql -u root -p

# Create a database for this project
CREATE DATABASE DFSAuth;

# You can create a database of any name but make sure the user and database name are properly set in .env

# Create a user specific for this project and grant all permissions on this newly created database
CREATE USER 'dfs-auth'@'localhost' IDENTIFIED  BY 'password';
GRANT ALL PRIVILEGES ON DFSAuth.* TO 'dfs-auth'@'localhost';

Setup Tables

Copy the contents of src/db/setup.sql and paste it in the mysql cli.

Setup keys for JWT (JSON web token) generation

Inside root of your repository

mkdir keys

# Generate Private Key
ssh-keygen -t rsa -b 2048 -m PEM -f keys/rsa.key

# Generate the Public Key
openssl rsa -in keys/rsa.key -pubout -outform PEM -out keys/rsa.key.pub

Run Auth Server

npm start

Testing API (Optional)

  1. Install Insomnia on your PC by following the instructions here.

  2. Import the collection in your insomnia panel from testingAPI.insomnia.json.

auth-service's People

Contributors

shaantanu011001 avatar shaantanu314 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.