My application has 2 different types of users - “USERS” and “PROVIDERS”, which I map to different roles in Keycloak. Think of it like task rabbit where normal people can ask for some service, and service providers can bid on providing that service.
I need to allow both “USERS” and “PROVIDERS” to register and log in with multiple identity providers, but I need them to automatically have different roles assigned based on where they originated from. i.e. if a normal user clicked “register” from the home page, they would be assigned the “USER” role. If they clicked “register” from the provider landing page, they would be assigned the “PROVIDER” role.
Is there any way of doing this in Keycloak through configuration? Or if code is the only way, are there any examples of how to do this? Since I’m allowing them to use social logins to register, I don’t know of a way to programmatically register them since I wouldn’t have any credentials to register them with.