Authentication on Nextjs middleware

I am using web3auth + auth0 for user authentication
Now, if a user is not authenticated or if the user tries to navigate to a different url which the application does not support, the the user should be redirected to the signin page
For that, I want to use the middleware in nextjs application.
Does web3Auth provide any middleware to achieve this functionality?

Originally posted by: KetulCodiste

Check the discussion at:

Hey @KetulCodiste

Web3Auth doesn't provide such middleware, but you can create your own middleware and use the web3auth state to check the log-in states and redirect users accordingly.

Originally posted by: shahbaz17

You can subscribe to Web3Auth Lifecycle Events to verify if the user is logged in or not. You can configure your redirection URLs accordingly.

Originally posted by: yashovardhan