How to recover your KeystoneJS admin password

  1. Remove every auth-related code in keystone.js. This will let you log into the development UI.
  2. From "Users" in the sidebar. open your admin user and change the user password.
  3. Restore keystone.js to its original state. Login with your new password.

This is not recommended for a production server.

My original keystone.js contents

import { config } from '@keystone-6/core';
import { lists } from './schema';
import { withAuth, session } from './auth';

export default config(
  withAuth(
    {
      db: {
        provider: 'sqlite',
        url: 'file:./keystone.db',
      },
      lists,
      session,
      ui: {
        isAccessAllowed: (context) => !!context.session?.data,
      },
    }
  )

);

Auth-related code removed:

import { config } from '@keystone-6/core';
import { lists } from './schema';

export default config(

  {
    db: {
      provider: 'sqlite',
      url: 'file:./keystone.db',
    },
    lists,
  }

);