I am looking for the best way to unblock automatically a blocked user account. Indeed a user might be blocked after several login attempts that failed. There is an API that can be used to unblock the user programmatically, but how can I check the duration from when the user was blocked? What is the best way to implement it? Can it be done into an Action? Will the Login flow be reached when a user is blocked?
Unfortunately, it is not possible to unblock a user automatically. Whenever a user is blocked, they are sent a blocked account email which they can unblock themselves by clicking on a link.
For now, you can unblock a user programmatically by calling the Management API’s Unblock a user endpoint, as you have found.
Let me also add that you could check when the user is blocked by checking your Logs and filtering for limit_wcLog event type code.