This behavior is expected in OIDC setups and is usually related to user provisioning and role assignment. What is happening is that the user is successfully authenticated by the IdP, but after you delete the user in Mendix, the next login either does not recreate the user properly or recreates it without any roles. The log “OIDC: no-roles handled … simple plain login” confirms this. Since the user has no roles, Mendix cannot create a valid session, which results in a 500 error and a redirect back to the login page.
Make sure your provisioning logic (for example CustomUserProvisioning) always creates the user if it does not exist and assigns at least one valid User Role. Since the issue only happens in PreProd, also check differences in role/claim mapping, environment constants, and whether the provisioning flow depends on data that may be missing there.
A simple and reliable fix is to add a fallback in your provisioning microflow: after role mapping, check if $Account/System.UserRoles is empty, and if so, retrieve a default role (for example “User”) and assign it to the account. This guarantees that the user can still log in even if role mapping fails.
As a quick test, delete the user, log in again, and check if the recreated user has any roles. If not, that is the root cause.
If this resolves your issue, please mark it as accepted.
Hi,
This is a classic OIDC provisioning issue, and your log already tells the exact problem:
OIDC: no-roles handled… simple plain login
Your flow:
/oauth/v2/callbackSo the failure is not authentication, it is missing role assignment during provisioning.
In Local:
In PreProd:
You must ensure that every OIDC login assigns at least one UserRole.
Go to:
OIDC Module → IdP Configuration
Check:
roles / groups)Example:
IdP Claim Value | Mendix Role |
user | User |
admin | Admin |
Important:
If mapping fails, always assign a default role.
SUB_OIDC_UserProvisioning or custom override)If $User/System.UserRoles = empty → Change Object (User) → Assign UserRole = 'User'
This guarantees login will never fail.
In OIDC configuration:
If available, set:
User
After login in PreProd:
UserRoles != empty
If empty → issue confirmed
When you delete user:
If provisioning fails → user has zero roles → login blocked
The issue is caused by missing role assignment during OIDC user provisioning. After deleting the user, the next login recreates the user but does not assign any UserRoles. Mendix does not allow users without roles, which results in the “OIDC: no-roles handled… simple plain login” error and a 500 response.
To resolve this, ensure that role mapping from the identity provider is correctly configured, or implement a fallback mechanism in the provisioning microflow to always assign at least one UserRole. This guarantees successful login even if role mapping fails.