Block a user account
Checklist
- [X] I agree to the terms within the Auth0 Code of Conduct.
Describe the problem you'd like to have solved
I sometimes find myself in a situation where I want to block many users at once. It would be nice to be able to script it in a shell script using the Auth0 cli.
Currently the Auth0 cli provides commands to list and remove blocks on user accounts, but no way to add a block.
Looking at the Auth0 API, it seems like the action I would want would be to set "blocked" to true on the user update endpoint. No equivalent flag is available on the auth0 users update command.
Describe the ideal solution
There should be a way to block a user using the Auth0 cli tool that's equivalent to blocking a user in the management dashboard.
Either an argument in auth0 users update, which would seem to match how this task would be accomplished using the User Management API, or a command like auth0 users blocks add.
Alternatives and current workarounds
As implied earlier, I could use the User Management API with curl or equivalent, but it would be a smoother workflow to use the cli tool that is already authenticated rather than having to set up a token-based way to authenticate.
Additional context
No response
Hey @hexpunk, whilst this isn't supported by the auth0 users update command currently, in the v1 beta you could achieve this using the auth0 api command that allows you to make authenticated requests to the Management API.
So to block a user you would use the following command auth0 api patch "users/<user_id>" --data "{\"blocked\": true }.
@ewanharris Thanks for the tip! I completely overlooked the auth0 api subcommand.
Hello @hexpunk,
We have introduced a new command auth0 users update <user-id> --blocked as part of the release v1.12.0.
Please do check it out and closing this issue for now..!