How to change the user role from microflow

I have a login page where on unauthorized access(API error/account locked/password wrong) I want to change the user role from 'User' to 'Guest'. I am able to achieve this by doing mx.logout after checking user is allowed to log in or not but in that case I am not able to show a invalid authorization label msg in the login page. Any other alternate way to achieve this.   Thanks in advance,
0 answers