Written in nodeJs, MongoDB and use SendGrid API as email service.
Clone the repository:
git clone https://github.com/ujjwall-R/Passwordless-authentication-APIs
cd Passwordless-authentication-APIs
Install the dependencies:
npm i
Get your sendgrid API from https://sendgrid.com. Setup the MONGODB ATLAS.
Create a .env file with following template:
SENDGRID_API_KEY=""
MONGODB_URL=""
SENDEREMAIL=""
Deploy the node app on any cloud service.
Register
POST /users/signup
#Request body
{
"name": "John Doe",
"email": "johnxxxxxxxxx@gmail.com",
"gender":"male"
}
#Response
{
"name": "John Doe",
"email": "johnxxxxxxxxx@gmail.com"
}
Login
POST /users/login
#Request body
{
"email":"johnxxxxxxxxx@gmail.com"
}
#Response
{
"user": {
"_id": "641ff966253xxxxxxxx",
"name": "John Doe",
"email": "johnxxxxxxxxx@gmail.com",
"gender": "male",
"__v": 1
}
}
Verify OTP
POST /users/verify
#Request body
{
"email":"johnxxxxxxxxx@gmail.com",
"otp":"xxxx"
}
#Response
{
"user": {
"_id": "641ff966253xxxxxxxx",
"name": "John Doe",
"email": "johnxxxxxxxxx@gmail.com",
"gender": "male",
"__v": 1
},
"token": "eyJhbGxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.