Authentication API using Nodejs && Express with all commun operations. Can be used as starter for other Nodejs app.
POST
|/api/auth/login
: login endpoint with email and password.POST
|/api/auth/registre
: register endpoint with username, email, password.GET
|/api/auth/activate/:token
: activate endpoint to activate account after registration.POST
|/api/auth/forgot
: forgot endpoint to send an email for updating password.GET
|/api/auth//reset/:id
: reset endpoint to verify and update the current password.GET
|/api/auth/logout
: logout endpoint.
- NodeJS
- Express
- Mongoose
- PassportJS
- JWT
- Nodemailer
- bcryptjs
- googleapis
git clone https://github.com/ankouri/Nodejs-auth-api.git
cd auth
npm install
MONGO_URL
: URL to connect to MongoDB.
SECRET_KEY
: set your own secret key for password hashing.
SESSIONKEY
: set your own session key.
Go to console.could.google.com
and setup an account for gmailapi, you can follow this video : https://www.youtube.com/watch?v=-rcRf7yswfM
.
OAUTH2CLIENT_ID
= Client ID
OAUTH2CLIENT_SECRET
= Client Secret
OAUTH2CLIENT_REDIRECT_URL
= Redirect Url
OAUTH2CLIENT_REFRESH_TOKEN
= Refresh Token
The Server should now be running at http://localhost:5000/
npm run dev