Giter VIP home page Giter VIP logo

Comments (3)

naterexw avatar naterexw commented on July 26, 2024 16
const Admin ={
	email : process.env.EMAIL_OF_ADMIN   || '[email protected]',
	password : process.env.PASSWORD_OF_ADMIN || 'coding'
};


AdminBroExpressjs.buildAuthenticatedRouter(adminBro,{
	authenticate:async(email, password)=>{
		if (email === Admin.email && password === Admin.password) {
			return Admin
		}
    return null
  },
  cookieName: process.env.COOKIE_ADMIN_NAME || 'C-4-P',
  cookiePassword: process.env.COOKIE_ADMIN_PASSWORD || 'admin-bro',
  },
  adminRouter,
  {
      resave:true,
      saveUninitialized: true
  }
);

I have passed the arguments like these but i still get the same errors

express-session deprecated undefined resave option; provide resave option node_modules\admin-bro-expressjs\plugin.js:131:14
express-session deprecated undefined saveUninitialized option; provide saveUninitialized option node_modules\admin-bro-expressjs\plugin.js:131:14
AdminBro: bundle ready

Thanks in Advance

You set it up wrong. Check here for correct way:
https://github.com/JSCasts-episodes/ep18-admin-bro-startup-part3

const router = buildAuthenticatedRouter(admin, {
  cookieName: 'admin-bro',
  cookiePassword: 'superlongandcomplicatedname',
  authenticate: async (email, password) => {
    const company = await Company.findOne({ email });

    if (company && await argon2.verify(company.encryptedPassword, password)) {
      return company.toJSON();
    }
    return null;
  },
}, null, {
  resave: false,
  saveUninitialized: true,
});

from adminjs-expressjs.

wojtek-krysiak avatar wojtek-krysiak commented on July 26, 2024 5

https://softwarebrothers.github.io/admin-bro-dev/module-admin-bro-expressjs.html#.buildAuthenticatedRouter has sessionOptions - you can pass resave and saveUninitialized there.

from adminjs-expressjs.

Swarag-N avatar Swarag-N commented on July 26, 2024
const Admin ={
	email : process.env.EMAIL_OF_ADMIN   || '[email protected]',
	password : process.env.PASSWORD_OF_ADMIN || 'coding'
};


AdminBroExpressjs.buildAuthenticatedRouter(adminBro,{
	authenticate:async(email, password)=>{
		if (email === Admin.email && password === Admin.password) {
			return Admin
		}
    return null
  },
  cookieName: process.env.COOKIE_ADMIN_NAME || 'C-4-P',
  cookiePassword: process.env.COOKIE_ADMIN_PASSWORD || 'admin-bro',
  },
  adminRouter,
  {
      resave:true,
      saveUninitialized: true
  }
);

I have passed the arguments like these but i still get the same errors

express-session deprecated undefined resave option; provide resave option node_modules\admin-bro-expressjs\plugin.js:131:14
express-session deprecated undefined saveUninitialized option; provide saveUninitialized option node_modules\admin-bro-expressjs\plugin.js:131:14
AdminBro: bundle ready

Thanks in Advance

from adminjs-expressjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.