Considerations for Custom Event Handling in Keycloak

Hello everyone,
i have already integrated various IdP’s such as Google, LinkedIn, Facebook, etc. into Keycloak 24.0.2, and the login process works smoothly without any issues. Now, I have a requirement where I want to redirect the users to a custom page(Angular Frontend) after a successful IdP First Login, where the users should complete their profile.

My initial approach was to implement the SPI CustomEventListener. The first idea was to intercept the event IDENTITY_PROVIDER_FIRST_LOGIN EVENT and add attributes to the UserModel. However, the user object is null, and I only receive the following informations from the event.

2024-03-30 17:34:39 2024-03-30 16:34:39,733 INFO [de.XYZ.keycloakeventsprovider.CustomEventListenerProvider] (executor-thread-55) Event:{identity_provider=linkedin-openid-connect, identity_provider_identity=test@abc.de, code_id=1a262d66-0a45-4a57-93f3-478a121e0893}

I don’t have any information about the username, so I can’t supplement the associated UserModel with attributes.

Furthermore, I’m not sure if the approach I’m taking is the ideal way to meet my requirements.