I have a collection of post, with an attribute called userId, where I keep the poster's ID. And the posts are made by calling
databases.createDocument(db, col, ID.unique(), {...data, userId: currentUser.$id}
This obviously sends a POST request to the Appwrite server but what worries me is, someone can use DevTools to mimic that request and put something else in the userId field, and it would seem as though someone else has posted that.
What to do in this case?
With a function you can get the user that is triggering it so you prevent someone from spoofing the ID
Thanks! With an Appwrite function endpoint, I can do that.
But can I also do the same in a custom endpoint in a different server? Here's what I want to do, in my web app:
// User is logged in
fetch("https://mycustomserver.com/", {method: 'POST', headers: 'SOME MAGIC'});
And in my server:
headers = request.get_headers()
user = users.get_from_cookies(headers['cookies'])
Something like this. I hope I'm clear.
No idea. I think best way is going with functions and their SDK
Recommended threads
- Appwrite Sites: ERR_TOO_MANY_REDIRECTS o...
So, my domain was working perfectly fine with Vercel. I was using cloudflare CDN (still am) but CNAME was DNS-only. I switched over to appwrite, CNAME is still ...
- How to disable appwrite/embedding from s...
Hi everyone! I'm currently running a self-hosted instance of Appwrite. For my current use case, I don't need the AI/embedding features, and I noticed the `app...
- Invalid type for attribute 'email': emai...
I'm using the node-appwrite SDK to create a table, the column payload looks like this: ```json [{"key":"email","type":"email","required":true, "size": 512}] ``...