How to protect API routes in next js with next auth
I want to secure my api routes in next js I tried the getServerSession method it works but only on client side I want to use both side please I need solution. I have a admin api and I want to make only for admin and for both side for client and server. Also on next-auth I tried the credentials provider but it’s not providing the access token.