After configuring adminjs with adonisjs, on login page submission getting below error
[10:36:59.660] WARN (19996): Invalid or expired CSRF token
request_id: "cxr22kmkdovlty98vsi5p3en"
x-request-id: "cxr22kmkdovlty98vsi5p3en"
Solution:
add admin login route into exceptRoutes in shiled.ts under config folder. Hope this would help someone in the future, cuz adminjs is a good admin panel for js frameworks. I was about to give up. But finally fixed this way,
csrf: {
enabled: true,
exceptRoutes: ['/admin', '/admin/login', '/admin/logout'],
enableXsrfCookie: false,
methods: ['POST', 'PUT', 'PATCH', 'DELETE'],
},