Skip to content

Latest commit

 

History

History
116 lines (88 loc) · 1.73 KB

File metadata and controls

116 lines (88 loc) · 1.73 KB

Password less Authentication Service APIs

Written in nodeJs, MongoDB and use SendGrid API as email service.

Installation

Clone the repository:

git clone https://github.com/ujjwall-R/Passwordless-authentication-APIs
cd Passwordless-authentication-APIs

Install the dependencies:

npm i

Usage

Get your sendgrid API from https://sendgrid.com. Setup the MONGODB ATLAS.

Create a .env file with following template:

.env

SENDGRID_API_KEY=""
MONGODB_URL=""
SENDEREMAIL=""

Deploy the node app on any cloud service.

APIs

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"
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT