Delete own account from the profile page or from admin API with own credentials? #445
-
Not sure if this is on here in some other form, but is it possible for a user who has created a profile to "delete" his own account? I was expecting some sort of function on the profile page. I also tried to call the admin user delete API with a token from the admin credentials, as well as the user's own credentials. This is the self-hosted version of Fief (0.28.8), by the way Is this possible at all? Thanks in advance and keep up the good work! Shrike71 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
OK... I think i might have figured this one out. I was using the wrong credentials to access the admin API. I created an API token as an admin, and then used that in the bearer to delete the non-admin user. However, what this means is that I have to write an endpoint in my OWN API that references the fief admin API with the admin token, and then invoke the
endpoint with the admin token in the authorization to delete the required user. It seems like an awful lot of power to delegate to a client application. It would end up having admin access to the entire fief implementation, would it not? Might this not be open to an impersonation attack unless some pretty specific CORS rules were put in place? |
Beta Was this translation helpful? Give feedback.
-
Indeed, there is currently no self-service endpoint for a user to delete its own account. The main difficulty when removing a user is all the implications that might happen to your own app: what do you do with all the data related to that user? The answer highly depends on your app. My advice would be to, like you suggest, implement an endpoint in your app for this purpose. The logic is up to you but it can be something like:
Regarding calling the Fief Admin API from your backend, there is nothing wrong with that. What you need is to keep the Admin API token safe in your backend (e.g. as environment variable) and have well-defined logic and input validation to make sure the end-user can't abuse it. |
Beta Was this translation helpful? Give feedback.
Indeed, there is currently no self-service endpoint for a user to delete its own account.
The main difficulty when removing a user is all the implications that might happen to your own app: what do you do with all the data related to that user? The answer highly depends on your app.
My advice would be to, like you suggest, implement an endpoint in your app for this purpose. The logic is up to you but it can be something like:
Regarding calling the Fief Admin API from your backend, there is nothing wrong with that. What you need is to keep the Admin API token safe in your backend (e.g. a…