NextAuth : The new way of authentication
It amazed me, the way I was able to authenticate using github or google. I had an authentication system already setup using jwt but still I wanted to incorporate this functionality of authentication using nextAuth.
There were some challenges, doubts and confusions regarding this like how do I store the user record in database when user is authenticated with github. Like in normal authentication, we have a process of taking user information while registering and giving him back a token in response which can be further utilised while logging.
In nextAuth its little bit different. Here the token gets stored in cookies.
Now, there are different way to get the user session on the client side and server side.
On client we can get the user session by useSession and on server by doing getServerSession
So, if we can have our authentication and authorization implemented.