help me protecting domain/api/* url endpoints if some one hit them, he get all data protect it
Unanswered
Irish Wolfhound posted this in #help-forum
Irish WolfhoundOP
hello all, in next js we declare api routes in app/api floder what if someone hits url like domain/api/users then , they will get all users data how to protect api url routes in backend, tell me some ideas to fix this so that api/* all urls all protected, youtube channels actually dont tell about these security vunerability, chat has api token so they check if request consist api token then they allow it, but how can i do this
2 Replies
you only send the data user has access to
for example, /api/chats should only return chats the user is added in and not all the chats the db has