How to setup auth for custom api route?

So I have setup a basic db authentification.
Now I want to apply auth check for my custom api route.
How do i do that?
From what I see, to my api route comes event with session cookie. So I’ll have to decrypt the cookies to check if user is allowed to use this api route.

Or maybe there is simpler, more straight forward way.
I tried to use isAuthenticated func from auth lib but it doesn’t work…


Already found the answer

1 Like