I have a requirement where I want to deactivate the user based on certain criteria. First I thought of deleting the user DELETE user and create it back if needed.
While going through docs, I found PATCH /user call with blocked
option. If I set this to true and call GET /user API then I get the response with "blocked":true
whereas if I call DELETE /user endpoint, I get user does not exists
(something like that) response.
I guess, I am not sure in what case I should use PATCH
call with blocked: true
.
Hi @gunjan.prmr ,
Thank you for posting this topic on the Auth0 Community!
To deactivate the users, we can block users to revoke their access to the Application. If deleting the users instead, they could try signing up again to get access to the Application.
I did the following test and here are the details.
- called the [PATCH user by id] with the below body scripts (Auth0 Management API v2) endpoint
{
"blocked": true
}
- verified that the user is blocked on the Auth0 Dashboard.
- called the Get a User endpoint, the user exists with
"blocked": true
.
- called the Delete a User endpoint
- verified that the user does not exist on the Auth0 Dashboard since it’s been deleted.
If you have followed the same steps and observed different responses, could you provide additional context? I am happy to look into this further.
Thank you!
I observed the same results. My question was more of a like “what is right path for my use case”. I want to deactivate the user based on some criteria, then should I call PATCH call with “blocked:true” or just delete the user.
I guess you are confirming that user shows blocked in Auth0 dashboard. Meaning, the user won;t be able to sign in, in this case. If true, then I will go with PATCH.
I suggest you use the patch call to block the users if you want to deactivate them
This topic was automatically closed after 13 days. New replies are no longer allowed.