Left side is client app using next js and right side is log of express js
Login.with.Google.Account.mp4
After clone this project, create your own .env file for environment variables in root project
NODE_ENV = <your node env>
CLIENT_BASE_URL = <your client base url>
SERVER_BASE_URL = <your server base url>
MONGO_URI = <your mongo uri>
ACCESS_TOKEN_SECRET = <your access token secret>
REFRESH_TOKEN_SECRET = <your refresh token secret>
EMAIL_SENDER = <your email sender name>
AUTH_EMAIL = <your email>
AUTH_EMAIL_PASSWORD = <your email password>
GOOGLE_CLIENT_ID = <your client id>
GOOGLE_CLIENT_SECRET = <your client secret>
- Express JS
- MongoDB & MongoDB Compass (client)
- Postman
- Linux (Zorin OS)
Method | Endpoints | Payload | Description |
---|---|---|---|
POST | /auth/register | {name, email, password} | Register new user and store it into mongoDB |
POST | /auth/login | {email, password} | Authenticate user |
POST | /auth/reset-password-link | {email} | When user forgot their password, they can request reset password link and send it to gmail |
POST | /auth/reset-password?token={{token}} | {new_password, new_password_confirmation} | Generate new password |
PUT | /auth/change-password | {old_password, new_password, new_password_confirmation} | Change password when user authenticated |
POST | /auth/email-verification | {email} | When the email verification token is invalid, user can request new email verification link |
GET | /auth/email-verification?token={{token}} | - | Verify user email |
GET | /auth/logout | - | Kick user from our system |
GET | /auth /generate-access-token | - | When access token is expired, user can request a new access token using refresh token |
Method | Endpoints | Payload | Description |
---|---|---|---|
GET | /auth/google/url | - | Generate authorization URL |
GET | /auth/google/callback | - | Callback for retrieve authorization code |
GET | /auth/google | - | Get google information profile |
- Input validation
- Implements access token and refresh token with JWT
- SMTP to send token to user email for verify email and reset password
- Login with google
- oauth2