Rest API BASE (Basic Auth social email) this is basic usage for authentication using email, facebook, and google, the database mongodb and using mongoose package
git clone https://github.com/mzcoder-hub/rest-base-jwt.git
cd rest-base-jwt
you can change the database string and the other ClientID and Client Secret the social media on the config > default.json
{
"mongoURI": "mongodb://localhost:27017/snackers",
"jwtSecret": "ThisisSecret",
"clientID": "YOUR_FACEBOOK_CLIENT_ID_HERE",
"clientSecret": "YOUR_FACEBOOK_CLIENT_SECRET_HERE",
"callbackURL": "http://localhost:5000/api/auth/facebook/callback",
"clientIDGoogle": "YOUR_GOOGLE_CLIENT_ID_HERE",
"clientSecretGoogle": "YOUR_GOOGLE_CLIENT_SECRET_HERE",
"callbackGoogleUrl": "http://localhost:5000/api/auth/google/callback"
}
to install dependency u can run this command
npm install
http://localhost:5000/api/auth/email/register
required method POST and the request should be
{
"name" : "Your Name ",
"email" : "your email",
"password" : "your password"
}
http://localhost:5000/api/auth/email
required method POST and the request should be
{
"email" : "your email",
"password" : "your password"
}
http://localhost:5000/api/auth/facebook
Require Method get will be redirect to facebook and get token on
http://localhost:5000/api/auth/facebook/accessToken
http://localhost:5000/api/auth/google
Require Method get will be redirect to Google and get token on
http://localhost:5000/api/auth/google/accessToken
the email service i have created that using the sendgrid web API email. you can register free at sendgrid.com
and change the API in cofig > default.json folder