The POST request to the API is encountering a 401 error, and I'm unable to retrieve the data.
Unanswered
American black bear posted this in #help-forum
American black bearOP
I created an API with Next.js and TypeScript. This API has a route named /api/paytr-bildirim, which is where the payment provider posts information about payments. I need to receive the POST data sent by the payment provider, but I'm getting a 401 unauthorized error. For now, this route needs to be public (*), as I don't know from which address the POST is coming.
I've added headers to my next.config settings, but the issue persists. I've also disabled the Vercel Authentication option from Vercel settings.
I'm using ClerkJS for API authentication, and I've updated the Clerk middleware settings, but I still couldn't resolve the issue.
Could you please assist me with this?
I've added headers to my next.config settings, but the issue persists. I've also disabled the Vercel Authentication option from Vercel settings.
I'm using ClerkJS for API authentication, and I've updated the Clerk middleware settings, but I still couldn't resolve the issue.
Could you please assist me with this?
15 Replies
American black bearOP
i think we cant find a fix :/
I think
/api/:path* doesn't work there? try /api/:path@Ray I think `/api/:path*` doesn't work there? try `/api/:path`
American black bearOP
Thank you for your response. I believe the correct usage is as shown in the image. When I make changes, even the GET requests from the frontend are blocked.
@American black bear Thank you for your response. I believe the correct usage is as shown in the image. When I make changes, even the GET requests from the frontend are blocked.
oh does it work if you add
/api/paytr-response to the array?@Ray oh does it work if you add `/api/paytr-response` to the array?
American black bearOP
Actually, the paytr-response route is already included. I mentioned /api/paytr-bildirim as the parameter, but it was written in the local language, so I referred to it as paytr-response.
American black bearOP
i hadn't tried it before, but I'm trying it now.
nope, same /
@American black bear Click to see attachment
does it say anything in the log?
@Ray does it say anything in the log?
American black bearOP
maybe try to enable debug in middleware?
authMiddleware({
debug: true
})@Ray maybe try to enable debug in middleware?
ts
authMiddleware({
debug: true
})
American black bearOP
Ah, now I can see some detailed data instead of just a simple error message. I think I can solve it based on this information. Thank you so much, Ray.
(I had tried debug mode before, but it didn't work. Interestingly, it worked this time.)
Anyway, thank you.
(I had tried debug mode before, but it didn't work. Interestingly, it worked this time.)
Anyway, thank you.