@codemaker219 @vazul Thanks for this post and it really helped me. Though I have a small problem and that is I have to identify User Role when first time token get exchange.
I am using Custom User Storage Provider SPI based on this sample KeycloakCustomUserStorageProvider. As my business database is mysql and new user needs to be stored in mysql.
So I have debugged and found that this method called from UserRegistrationProvider interface.
@Override
public UserModel addUser(RealmModel realmModel, String username) {
logger.info("Calling addUser (username: {})",username);
return null;
}
But Problem is I cant find the way to identify about what role should be assigned. Because I have three types of users which can logged in by apple social login. Admins, Managers, Customers. For each this method called but I could not figure out how to identify the role?
I really grateful if you could hint me in right direction.