Next.js Discord

Discord Forum

reaching endpoints

Unanswered
Briard posted this in #help-forum
Open in Discord
BriardOP
can we try out nextjs api endpoints using postman when deploying on vercel in production mood?

for example I have tried to send post request to my login endpoint but it returned 401 error

5 Replies

Asian swamp eel
401 means unauthorized so probably some rule that restricts api calls from the same domain. you may be able to get away with spoofing the hostname in your headers but i doubt it would be that easy
Yea you definitely hit it, they’re public endpoints.
If you’re checking auth in middleware or directly inside the API handler it’s gonna check for your token and fail if not exists
@Briard solved?
@LuisLl <@695222810863206431> solved?
BriardOP
no , i still cant test my endpoints on vercel
Do you have a middleware that’s checking for authorization? Route handlers have to pass through middleware too