0

I am trying to use adminjs's build authenticated router with feathers express and mongoose but I just can't.

import AdminJS from 'adminjs';
import {Mongoose} from 'mongoose';
import AdminJSMongoose from '@adminjs/mongoose';
import AdminJSExpress from "@adminjs/express";
import session from 'express-session';
import MongoStore from 'connect-mongo';

const sessionOptions = MongoStore.create({
  collectionName: "sessions",
  mongoUrl: app.get('mongodb'),
  stringify: false,
  autoRemove: "interval",
  autoRemoveInterval: 1,
});

const adminRouter = AdminJSExpress.buildAuthenticatedRouter(
  admin, {
    authenticate,
    cookieName: 'admin',
    cookiePassword: 'password',
  },
  null, {
    store: sessionOptions,
    resave: true,
    saveUninitialized: true,
    secret: 'password',
    cookie: {
      httpOnly: process.env.NODE_ENV === 'production',
      secure: process.env.NODE_ENV === 'production',
    },
    name: 'admin',
  }
)
app.use(admin.options.rootPath, adminRouter);

AdminJS dependencies versions:

"admin-bro": "^4.0.1",
"adminjs": "^6.7.5",

What browsers do you see the problem on? Safari

Relevant log output invalid react hook call

Relevant code that's giving you issues /admin/login page

I tried almost everything.

rickhg12hs
  • 10,638
  • 6
  • 24
  • 42
JalalMitali
  • 1
  • 1
  • 2

0 Answers0