In next.js where should i do the authentication?

Viewed 653

I'm using next.js with redux toolkit. My back-end REST API is written with node.js and express with jwt tokens.

When the user signs up I have a lot of possibilities where can I implement the logic.

e.g.

getInitialProps()
getStaticProps
getServerSideProps

or I can do it neither of those with my own function and let next decide what to do.

What is the best practice? Where should I put the code for registration and login?

0 Answers
Related