aznamier/keycloak-event-listener-rabbitmq

No Register event with Google Social Login registration

Closed this issue · 2 comments

Running Keycloak 19.0.1 I'm unable to receive Registration events after creating a new account via Google Social Login.

Instead the Login event is being sent twice:

2022-08-01 17:51:56,678 INFO  [com.github.aznamier.keycloak.event.provider.RabbitMqEventListenerProvider] (executor-thread-42) keycloak-to-rabbitmq SUCCESS sending message: KK.EVENT.CLIENT.xxx.SUCCESS.dashboard-local.LOGIN

2022-08-01 17:51:56,684 INFO  [com.github.aznamier.keycloak.event.provider.RabbitMqEventListenerProvider] (executor-thread-42) keycloak-to-rabbitmq SUCCESS sending message: KK.EVENT.CLIENT.xxx.SUCCESS.dashboard-local.LOGIN

2022-08-01 17:51:57,787 INFO  [com.github.aznamier.keycloak.event.provider.RabbitMqEventListenerProvider] (executor-thread-42) keycloak-to-rabbitmq SUCCESS sending message: KK.EVENT.CLIENT.xxx.SUCCESS.dashboard-local.CODE_TO_TOKEN

The events listen in the Keycloak admin panel have the correct events:
image

Edit:

Upon closer inspection, I've found a way to derive the registration events from the event stream. The buggy events have two peculiarities:

{
  "@class" : "com.github.aznamier.keycloak.event.provider.EventClientNotificationMqMsg",
  "time" : 1659376316668,
  "type" : "LOGIN",
  "realmId" : "xxx",
  "clientId" : "dashboard-local",
  "userId" : "3444c98f-38f4-4d4c-8511-2cfe62495a7a",
  "sessionId" : "c85eed8e-59ff-48eb-a785-0280e7c0e809",
  "ipAddress" : "xx.xx.xx.xx",
  "details" : {
    "identity_provider" : "google",
    "register_method" : "broker",
    "response_type" : "code",
    "consent" : "no_consent_required",
    "identity_provider_identity" : "xxx@gmail.com",
    "code_id" : "c85eed8e-59ff-48eb-b781-0280e7c0e809",
    "email" : "xxx@gmail.com",
    "username" : "xxx@gmail.com",
    "response_mode" : "fragment"
  }
}
  1. The property "register_method" : "broker" is present only in case of these two Login events after registration.
  2. Both events have always the same timestamp.

Using this it's possible to write a microservice that consumes login events and sends registration events back to RabbitMQ for other apps to consume. I'm currently running this in production and it works, at least for Google.

Edit 2:
I can confirm that the same issue exists for Facebook Social Login. Same workaround applies.

Referencing #25 from @CipherdevNL (thank you!)

Fixed in 3.0.1