You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As per the suggestions, people need the package to be available locally, and also have them easily set for hosting,
Privacy concerns , Even though we never share any email ID's that was sent using the package two-step-auth, and neither do we use it for our purposes, people wanted their own server so this was created on top of that, You have control on your data.
You have control on your data
Own Mail ID
Host on your favorite servers / Micro servers
Greater speeds of sending mails
Usage (server side configuration)
Create a config file inside the project and add the following variables to the ENV file
Import the authSetupFiles object from the package.
const{authSetupFiles}=require('auth-setup')
Declare your config file path.
authSetupFiles.filePath="test.env"
Delcare your session name / Company Name (optional)
authSetupFiles.sessionName="Sample"
Declare your favorite route to use with the package and point it using the app.use() method.
app.use("/email",authSetupFiles.emailRouter)
You are all done for the backend setup 👍
Usage (accessing the routes from Frontend)
Check if credentials pass initial test.
I am using localhost:5000 as the parent route here, it is applicable for all other routes.
To check if the package is able to login to the Mail ID provided, performa get request so the script will login to your Email ID and then give you a call back in JSON stating if it was success. Pass the route you specified in the previous step. ... app.use('/email', ...)
All you need to do is to send a POST Request to the same route that you specified with the query containing the Paramaters : ?reciptantMail=dummy@dummy.com
POST http://localhost:5000/email?reciptantMail=dummy@dummy.com
This will yield you an OTP and the JSON will look as follows.