Skip to content

"Invalid credentials. User is blocked" when trying to sign up an account that has been deleted before #744

Closed

Description

@saibotma

🐛 Bug Report

Deleted my account but i had to reload the page after pressing the delete button to get logged out.
I tried to sign up a new user but now i get 401: Invalid credentials. User is blocked when trying to sign up and sign in.

To Reproduce

  1. Setup clean instance op Appwrite
  2. Sign up an account
  3. Delete the account
  4. Try to sign up a new account

Expected behavior

Should sign up the new account.

Actual Behavior

Displays the error message: "Registration Failed. Please try again later"

Your Environment

Browser: Firefox 83.0
Appwrite: 0.6.2

Activity

  1. added
    bug
    on Dec 1, 2020
  2. eldadfux commented on Dec 1, 2020

    @eldadfux
    Member

    @saibotma I can confirm DELETE /account route does only account blocking and not actually deleting it. This was done to prevent abuse, the use case in mind was when a hacker take control over the account and maliciously deletes it. That way a developer can always recover the account.

    In version 0.7 we have added real account deletion, but only limited to user DETELE /user/[user-id] route. @saibotma do you think we should change this behavior?

    @TorstenDittmann as you were the one working on this area in 0.7, I would love to get your thoughts on this.

  3. saibotma commented on Dec 1, 2020

    @saibotma
    Author

    Strangely enough the sign up did not work with an other new account not just the deleted one.
    Maybe we should check this.

    I think it's confusing than delete just blocks a user. It should then be named "block" instead of "delete".

  4. eldadfux commented on Dec 1, 2020

    @eldadfux
    Member

    Strangely enough the sign up did not work with an other new account not just the deleted one.
    Maybe we should check this.

    Would be great if you could confirm this is still happening and can be reproduced.

    Edit: might be related to the old user session still trying to authenticate? still happens on a browser without cookies, or after cleaning them?

    I think it's confusing than delete just blocks a user. It should then be named "block" instead of "delete".

    @saibotma or maybe have a new deleted status? @TorstenDittmann what do you think?

  5. TorstenDittmann commented on Dec 1, 2020

    @TorstenDittmann
    Contributor

    I think using the DELETE method is fine for the /account endpoint. Maybe adapt the sdk method name to block().

    In terms of deleting the user, I would still recommend this to be Server SDK exclusive for security reasons.

    I don't know what value a deleted state would give ,deleted means removed and not visible anymore IMO. Changing the method call to block might be sufficient enough to prevent confusion.

  6. eldadfux commented on Dec 1, 2020

    @eldadfux
    Member

    We started using the DELETE /account because that better reflects what the user want to achieve. That said, most use-cases I'm aware of, an as a best security practice this would be way to risky action to allow from the client.

    I guess that if we'll change the method name to blockAccount, one of the most requested features here will be to add a delete method, which is not something we really want to support (mainly security wise). This might also make the REST compatibility a bit tricky and introduce some new naming conventions dilemmas.

  7. TorstenDittmann commented on Dec 1, 2020

    @TorstenDittmann
    Contributor

    The only implementation of giving users the ability to remove their accounts would be the following:

    1. Request Account removal
    2. Confirm by mail
    3. Account deleted after x days if no session created past confirmation of the removal

    This involves more work and is up to @eldadfux to adapt such pattern and how it's prioritized.

    Edit: At this stage we could make delete() deleting the user and introduce block() for blocking. Even though that would be the most breaking change possible for SDK's 😄

  8. saibotma commented on Dec 1, 2020

    @saibotma
    Author

    @TorstenDittmann this sounds like a clean solution even though it is more complicated to implement.

    What confused me was actually not the DELETE http method - I actually did not know about it - but the naming in the UI.
    Renaming the UI from "delete" to "block" would probably help to avoid confusion.

    However, I have to say that as an API user I would expect DELETE to really delete a resource and in order to block it I would use PATCH maybe.

  9. eldadfux commented on Dec 1, 2020

    @eldadfux
    Member

    The only implementation of giving users the ability to remove their accounts would be the following:

    1. Request Account removal
    2. Confirm by mail
    3. Account deleted after x days if no session created past confirmation of the removal

    This involves more work and is up to @eldadfux to adapt such pattern and how it's prioritized.

    Edit: At this stage we are able to make delete() deleting the user and introduce block() for blocking.

    I think this is a reasonable alternative, that will help reduce the security risk. One issue is that we can count on the user to have an email anymore as we plan to introduce new "email-less" login methods.

    This would also require us to think of a way to provide a delete revert action (maybe in the dashboard?)

  10. eldadfux commented on Dec 1, 2020

    @eldadfux
    Member

    However, I have to say that as an API user I would expect DELETE to really delete a resource and in order to block it I would use PATCH maybe.

    Agree, and we actually do use PATCH to change the status from active to blocked in the Users API 🤨

  11. saibotma commented on Dec 1, 2020

    @saibotma
    Author

    Sorry but i am a bit confused. Are we now talking about accounts or users, because according to the docs when deleting an account using DELETE it gets blocked.

  12. TorstenDittmann commented on Dec 1, 2020

    @TorstenDittmann
    Contributor

    Account is the Client SDK endpoint for the currently logged in account. Users is the Server SDK Endpoint to manage all accounts 👍

  13. saibotma commented on Jan 19, 2021

    @saibotma
    Author

    Ah, now I get it. I was actually talking about Appwrite accounts, the accounts that have access to the dashboard.

  14. eldadfux commented on Jan 19, 2021

    @eldadfux
    Member

    @saibotma the dashboard is using the exact same Appwrite APIs :) Account API for your dashboard user, Users API for managing your project users

  15. TorstenDittmann commented on Apr 6, 2021

    @TorstenDittmann
    Contributor

    This issue had no recent activity and looks more or less solved. I will close it and if further activity occurs can be re-opened again. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions