Redirect to my service after google signIn

Hello everyone,
I am trying to create my own custom page for the login into Keycloak, with social login (Google). similar use case
After google prompt’s successful login, i need google to redirect to my service instead of Keycloak. Then my service makes a request to Keycloak passing the query params received by google, and the 3 cookies needed(AUTH_SESSION_ID, AUTH_SESSION_ID_LEGACY and KC_RESTART) as google would in the typical authentication flow. (keycloak url is http://{{server}}/auth/realms/{{realm}}/broker/google/endpoint )
However, i receive 502 Bad gateway status (http body message is “Unexpected error when authenticating with identity provider”), and Keycloak service logs the following error

ERROR [org.keycloak.broker.oidc.AbstractOAuth2IdentityProvider] (default task-1) Failed to make identity provider oauth callback: org.keycloak.broker.provider.IdentityBrokerException: No access_token from server. error=‘redirect_uri_mismatch’, error_description=‘Bad Request’, error_uri=‘null’

I should also mention that if let google redirect to Keycloak everything works as expected. Any thoughts? Maybe the endpoint needs additional input that i’m missing?