Next.js Discord

Discord Forum

protect route handler

Answered
Australian Freshwater Crocodile posted this in #help-forum
Open in Discord
Avatar
Australian Freshwater CrocodileOP
i think i may be way off on the way im thinking and need help with some clarity.

i have my route.js in the api/protect/ folder as GET route handlers and i want to protect it from getting accessed without being logged in. im using supabase for auth. do i just need to send the token and verify it on the api route or it there some middleware i need to use, any help or links would be amazing as im stuck in the mud. thanks
Answered by ncls.
You can do it right inside the API or with a middleware. It's up to you
View full answer

2 Replies

Avatar
You can do it right inside the API or with a middleware. It's up to you
Answer
Avatar
Australian Freshwater CrocodileOP
thanks