Next.js Discord

Discord Forum

How We Securely Implement Server Action?

Answered
American black bear posted this in #help-forum
Open in Discord
Avatar
American black bearOP
How can we securely implement a server action that requires passing userId as a parameter, considering the potential risks of unauthorized access through network requests?

For example
Edit Name with server action

we need to pass userId and newName to server action

but it can make a network POST request, so anyone can curl to our server action

8 Replies

Answer
Avatar
POST request? are you talking about API route handlers?
API route handlers are different from server actions
Avatar
American black bearOP
i mean like that
Image
this what i'm looking for btw
thanks
Avatar
@American black bear don't forget to mark it solved 🙂
Avatar
American black bearOP
thanks