nextjs route middleware for authentication

前端 未结 2 723
庸人自扰
庸人自扰 2021-01-31 22:26

I\'m trying to figure out an appropriate way of doing authentication, which I know is a touchy subject on the GitHub issue page.

My authentication is simple. I store a

2条回答
  •  不知归路
    2021-01-31 22:55

    Tim from the next chat helped me solve this. Solution can be found here but I will quote him so you all can see:

    • You can do the check in _app.js getInitialProps and redirect like this
    • Example of how to use it
    • _app.js documentation

    I've also created an example skeleton template you can take a look at.

提交回复
热议问题