Skip to content

Commit 2567653

Browse files
committed
readme updated
1 parent ca5c506 commit 2567653

File tree

2 files changed

+63
-66
lines changed

2 files changed

+63
-66
lines changed

ReadMe.md

Lines changed: 60 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ This project provides a robust and secure authentication system for your Node.js
88
* [Tech Stack](#tech-stack)
99
* [Installation](#installation)
1010
* [API Endpoints](#api-endpoints)
11-
* [Contributing](#contributing)
12-
* [License](#license)
1311

1412

1513
## Features <a name="features"></a>
@@ -31,9 +29,9 @@ This project provides a robust and secure authentication system for your Node.js
3129
* Long-lived refresh tokens (7 days) for seamless token renewal.
3230
* Access tokens are sent via the `Authorization` header (Bearer token).
3331
* **Security:**
34-
* Protection against common vulnerabilities. (Mention specific protections if implemented, e.g., rate limiting, input validation)
32+
* Protection against common vulnerabilities.
3533
* **Scalability:**
36-
* Designed for scalability using Redis for caching. (Explain what you're caching)
34+
* Designed for scalability using Redis for caching.
3735

3836
[Go to Table of Contents](#table-of-contents)
3937

@@ -63,91 +61,88 @@ This project provides a robust and secure authentication system for your Node.js
6361

6462
1. **Clone the Repository:**
6563

66-
```bash
67-
git clone https://github.com/rahulstech/node-authentication-with-email-verification.git
68-
69-
cd node-authentication-with-email-verification
70-
````
71-
72-
2. **Environment Variables:**
73-
74-
* Copy `.env-copy` to `.env`.
75-
* Fill in the required credentials:
76-
* Google OAuth Client ID and Secret
77-
* AWS SES credentials (IAM user with SES permissions)
78-
* Redis host and port (defaults are usually fine)
79-
80-
<!-- end list -->
81-
82-
```
83-
# Example .env file
84-
GOOGLE_CLIENT_ID=your_google_client_id
85-
GOOGLE_CLIENT_SECRET=your_google_client_secret
86-
AMAZON_ID=your_aws_iam_id
87-
AMAZON_SECRET=your_aws_iam_secret
88-
AMAZON_REGION=your_aws_region
89-
EMAIL_VERIFICATION_SENDER=your_verified_ses_email
90-
REDIS_HOST=localhost
91-
REDIS_PORT=6379
92-
```
64+
```bash
65+
git clone https://github.com/rahulstech/node-authentication-with-email-verification.git
66+
67+
cd node-authentication-with-email-verification
68+
````
69+
70+
2. **Environment Variables:**
71+
72+
* Copy `.env-copy` to `.env`.
73+
* Fill in the required credentials:
74+
* Google OAuth Client ID and Secret
75+
* AWS SES credentials (IAM user with SES permissions)
76+
* Redis host and port (defaults are usually fine)
77+
78+
```
79+
# Example .env file
80+
GOOGLE_CLIENT_ID=your_google_client_id
81+
GOOGLE_CLIENT_SECRET=your_google_client_secret
82+
AMAZON_ID=your_aws_iam_id
83+
AMAZON_SECRET=your_aws_iam_secret
84+
AMAZON_REGION=your_aws_region
85+
EMAIL_VERIFICATION_SENDER=your_verified_ses_email
86+
REDIS_HOST=localhost
87+
REDIS_PORT=6379
88+
```
9389

9490
3. **JWT Keys:**
9591

9692
* Generate RSA key pair for JWT signing (using OpenSSL):
9793

98-
<!-- end list -->
99-
100-
```bash
101-
openssl genpkey -algorithm RSA -out jwt_private.pem -pgenopt rsa:key_gen_bits:4096
102-
openssl rsa -in jwt_private.pem -pubout -out jwt_public.pem
103-
```
94+
```bash
95+
openssl genpkey -algorithm RSA -out jwt_private.pem -pgenopt rsa:key_gen_bits:4096
96+
openssl rsa -in jwt_private.pem -pubout -out jwt_public.pem
97+
```
10498

10599
* Place `jwt_private.pem` and `jwt_public.pem` in the `secrets` directory. *(Create the `secrets` directory if it doesn't exist.)*
106100
107-
4. **Database Setup:**
108101
109-
* Configure MySQL connection in `config/config.json`.
110-
* Create the database and run migrations:
111-
112-
<!-- end list -->
102+
4. **Install Dependencies:**
113103
114104
```bash
115-
npx sequelize-cli db:create
116-
npx sequelize-cli db:migrate
105+
npm install
117106
```
118107
119-
5. **Install Dependencies:**
120-
121-
<!-- end list -->
108+
5. **Database Setup:**
122109
123-
```bash
124-
npm install
125-
```
110+
* Configure MySQL connection in `config/config.json`.
111+
* Create the database and run migrations:
126112
127-
6. **Run the Server:**
113+
```bash
114+
npx sequelize-cli db:create
115+
npx sequelize-cli db:migrate
116+
```
128117
129-
<!-- end list -->
130118
131-
```bash
132-
npm run dev # (or npm start if you have that script defined)
133-
```
119+
6. **Run the Server:**
134120
121+
```bash
122+
npm run dev # (or npm start if you have that script defined)
123+
```
135124
136-
* The server will typically start on port 5000 (configurable in `.env`).
125+
The server will typically start on port 5000 (configurable in `.env`).
137126
138127
139-
[Go to Table of Contents](https://www.google.com/url?sa=E&source=gmail&q=#table-of-contents)
128+
[Go to Table of Contents](#table-of-contents)
140129
141130
## API Endpoints <a name="api-endpoints"></a>
142131
143-
*(Provide a few key API endpoint examples with request methods, URLs, request bodies (if needed), and response examples. This is crucial for developers wanting to use your API.)*
144-
145132
```
146-
POST /auth/register - Register a new user
147-
POST /auth/login - Login a user
148-
GET /auth/verify/:token - Verify email
149-
POST /auth/resend-verification - Resend verification email
150-
# ... (add more endpoints)
133+
POST /register - Register a new user
134+
POST /login - Login a user with email and password
135+
GET /login/google - Login via google
136+
GEt /google/callback - Web hook used by google oauth server on authenticated
137+
GET /dashboard -
138+
POST /refresh - Generates new access token based on sent refresh token in request body
139+
GET /verify/email/link - Send a new email verification link to registered email, requires login
140+
GET /verify/email - Verify email
141+
PATCH /email/new - Change email, requires login
142+
POST /password/reset/link - Generate the password reset link
143+
PATCH /password/reset - Reset password if forget
144+
PATCH /password/new - Change password, requires log in
145+
GET /logout - Log out, requires login
151146
```
152147
153-
[Go to Table of Contents](https://www.google.com/url?sa=E&source=gmail&q=#table-of-contents)
148+
[Go to Table of Contents](#table-of-contents)

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@
3434
"passport-jwt": "^4.0.1",
3535
"passport-local": "^1.0.0",
3636
"redis": "^4.7.0",
37-
"sequelize": "^6.37.5",
37+
"sequelize": "^6.37.5"
38+
},
39+
"devDependencies": {
3840
"sequelize-cli": "^6.6.2"
3941
}
4042
}

0 commit comments

Comments
 (0)