Skip to content

Extending keystone-6/auth sessionData #7312

Answered by emmatown
noor-codes asked this question in Questions
Discussion options

You must be logged in to vote

You can do this by augmenting the session config like this:

const ksConfig = withAuth(
  config({
    // your keystone config
  })
);

export default config({
  ...ksConfig,
  session: {
    ...ksConfig.session!,
    async get(args) {
      const control = await args
        .createContext({ sudo: true })
        .query.Control.findOne({ where: { id: 'whatever' } });
      return {
        ...ksConfig.session!.get(args),
        control,
      };
    },
  },
});

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@noor-codes
Comment options

@noor-codes
Comment options

Answer selected by emmatown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants