Skip to content

Do we still need middleware? #25

Answered by CrawlerCode
engin-can asked this question in Q&A
Discussion options

You must be logged in to vote

No, this does not imply that you do not need to use middleware. The local strategy is a Payload CMS feature and is absolutely unrelated to Auth.js. enableLocalStrategy: true only allows you to combine both strategies.


General, you don't need the middlware, using it is optional. Auth.js offers you various options and you can configure it according to your requirements, depending on your use case.

The benefit of the middleware are:

  • keep the session alive
  • protecting pages (if you specify an authorized callback)

If you don't want to do this, you don't need middlware.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@CrawlerCode
Comment options

Comment options

You must be logged in to vote
1 reply
@engin-can
Comment options

Answer selected by CrawlerCode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants