token expiry changed to 30d

master
varun 3 years ago
parent 0b7d7dfd9d
commit 6b9f68297e

@ -31,10 +31,6 @@ const fastify = require("fastify")({
// }, // },
// }); // });
// fastify.register(View).ready((err) => { // fastify.register(View).ready((err) => {
// if (err) console.error(err); // if (err) console.error(err);
@ -88,6 +84,7 @@ const apiversion = "1.0.0";
const path = require("path"); const path = require("path");
// Using static content for swagger documentation. Generated swagger UI is not user friendly. // Using static content for swagger documentation. Generated swagger UI is not user friendly.
fastify.register(require("fastify-static"), { fastify.register(require("fastify-static"), {
root: path.join(__dirname, "api-docs"), root: path.join(__dirname, "api-docs"),
prefix: "/api-docs", // optional: default '/' prefix: "/api-docs", // optional: default '/'
@ -203,7 +200,7 @@ fastify.post("/api/login", {
//expiresIn: expressed in seconds or a string describing a time span zeit/ms. Eg: 60, "2 days", "10h", "7d". //expiresIn: expressed in seconds or a string describing a time span zeit/ms. Eg: 60, "2 days", "10h", "7d".
//A numeric value is interpreted as a seconds count. If you use a string be sure you provide the time units (days, hours, etc), //A numeric value is interpreted as a seconds count. If you use a string be sure you provide the time units (days, hours, etc),
//otherwise milliseconds unit is used by default ("120" is equal to "120ms"). //otherwise milliseconds unit is used by default ("120" is equal to "120ms").
{ expiresIn: "300000" } { expiresIn: "30d" }
); );
var arr = loginObject.user.profile.role; var arr = loginObject.user.profile.role;
var arrayToString = JSON.stringify(Object.assign({}, arr)); // convert array to string var arrayToString = JSON.stringify(Object.assign({}, arr)); // convert array to string
@ -299,7 +296,7 @@ fastify.get("/api/reset_token/:customerId", {
userId: get_user._id, userId: get_user._id,
roles: get_user.profile.role, roles: get_user.profile.role,
}, },
{ expiresIn: "300000" } { expiresIn: "30d" }
); );
reply.send({ access_token: token, customerId: get_user.customerId }); reply.send({ access_token: token, customerId: get_user.customerId });
} catch (err) { } catch (err) {

Loading…
Cancel
Save