Search code examples
javacharacter-encodingsingle-sign-onkeycloakgoogle-signin

keycloak: google login character encoding error


We are using keycloak standalone server to authenticate our users. Social IDPs: google and facebook login work perfectly, except the following mistake:

If on your google account first and last names are written with non-ascii characters, keycloak doesn't read them properly.

For instance: Name on the google account is Собиров Валижон. What I get on keycloak is РЎРѕР±РёСЂРѕРІ Валижон

Steps to reproduce the issue:

  • add test realm and client
  • add google identity provider settings
  • login with google user who has non-ascii chars in first or lastname (in my case Собиров Валижон)
  • see keycloak test realms user database

It would be appreciated if someone could solve the issue.

screenshot from keycloak account

screenshot from google account


Solution

  • The only solution I could find was to put default encoding in JVM.

    Add default encoding to standalone.conf

    JAVA_OPTS="$JAVA_OTPS -Dfile.encoding=UTF8"