feat: add delete-account Cloud Function for permanent user auth deletion (#758)#166
Conversation
Closes #758. The client-side Appwrite SDK has no hard-delete endpoint for auth accounts. This server-side Cloud Function calls the Appwrite Users API (users.deleteUser) to permanently remove the auth record after the Flutter app has already cleaned up the profile doc, username doc, and profile picture. Appwrite cascade relationships handle followers/friends automatically. The function is secured by reading x-appwrite-user-id from the request header, which Appwrite sets automatically when an authenticated user invokes a function, ensuring users can only delete their own account. Related Flutter PR: AOSSIE-Org/Resonate#786
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Fixes #758 — Account Deletion Does Not Permanently Remove User Data.
The Appwrite client SDK has no hard-delete endpoint for auth accounts. Without a server-side call, the auth record persists indefinitely even after the user's profile data is removed, meaning the user could theoretically re-authenticate with old credentials or the account occupies space in the system.
This PR adds a new
delete-accountCloud Function that calls the Appwrite Users API (users.deleteUser) server-side to permanently and irreversibly remove the auth account.What this PR does
functions/delete-account/withsrc/main.js,src/utils.js, andpackage.jsonappwrite.jsonwithusers.read+users.writescopesx-appwrite-user-idfrom the request header (set automatically by Appwrite for authenticated invocations) — ensuring a user can only delete their own account401if no authenticated user is present,500on Appwrite error,200on successDeletion flow (end-to-end)
The Flutter client (see related PR) handles:
user-imagesstorage bucketusernamescollectionuserscollectionaccount.deleteSessions()to invalidate any remaining tokensAppwrite cascade relationships automatically handle deletion of
followersandfriendssub-documents.Related