Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account deletion function #1038

Open
erkinovalim opened this issue Sep 17, 2024 · 4 comments
Open

Account deletion function #1038

erkinovalim opened this issue Sep 17, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@erkinovalim
Copy link

erkinovalim commented Sep 17, 2024

There is no function for the users to delete their own account.

I would like a simple function that would allow users to delete their own account like:
Supabase.auth.deleteAccount(
email: [email protected]
password: 123456
)

Alternative:
Maybe delete the user's row from the 'users' table then delete the account from 'auth.users' table manually? But this would be slow and you would have to manually search for accounts that don't have a row in 'users' table

@erkinovalim erkinovalim added the enhancement New feature or request label Sep 17, 2024
@Vinzent03
Copy link
Collaborator

Deleting users requires the service_role key. This is also true for deleting your own account. The method to delete users in dart already exists, but you probably want to delete a user from an edge function to not expose your service_role key.

@erkinovalim
Copy link
Author

So I should make an Edge Function that would allow users to delete their own account?

@Vinzent03
Copy link
Collaborator

Yeah you just have to ensure via the jwt and so on that they can only delete their own account.

@erkinovalim
Copy link
Author

I am a beginner and I don't really understand backend stuff. Could you explain how to use that please? I would appreciate if you could write the edge function code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants