-
Notifications
You must be signed in to change notification settings - Fork 4
UUID API
A universal unique identifier (UUID) is a standard of generating identifiers, standardized by the Open Software Foundation (OSF).
The intent of UUIDs is to be able to generate unique identifiers in a distributed system UUID is meant for generating UUIDs from truly-random or pseudo-random unique numbers.
npm install uuid
In our application once the user is logged in, each subsequent request to a page will internally call the JWT, allowing the user to access routes, services, and resources that are permitted with that token. Single Sign On is a feature that widely uses JWT nowadays, because of its small overhead and its ability to be easily used across different domains. In order to generate the random number unique value and pass to the URL of forget password
/users/forgot Here we are generating unique random number by using UUID API
/users/reset/:token(GET) Generated token is passed as a parameter request to the forgot mail /users/reset/:token(POST) The same UUID is sent to update the password to corresponding user
const token = uuidv4();
console.log(token);
let mailOptions =
/users/reset/:token(GET) Use token and send to URL of mail /users/reset/:token(POST) Use the generated token to keep get details of the user and update password
Insert into the token table generated token and 4 digit user id
More information can be obtained from https://www.npmjs.com/package/uuid