diff --git a/docs/documentation/securing_apps/topics/oidc/javascript-adapter.adoc b/docs/documentation/securing_apps/topics/oidc/javascript-adapter.adoc index 3fcf1a879b..3ec5eb37f2 100644 --- a/docs/documentation/securing_apps/topics/oidc/javascript-adapter.adoc +++ b/docs/documentation/securing_apps/topics/oidc/javascript-adapter.adoc @@ -375,6 +375,7 @@ reference link:{adminguide_link}#_client_scopes[Client scopes] defined on a part always added to the list of scopes by the adapter. For example, if you enter the scope options `address phone`, then the request to {project_name} will contain the scope parameter `scope=openid address phone`. * messageReceiveTimeout - Set a timeout in milliseconds for waiting for message responses from the Keycloak server. This is used, for example, when waiting for a message during 3rd party cookies check. The default value is 10000. +* locale - When onLoad is 'login-required', sets the 'ui_locales' query param in compliance with https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest[section 3.1.2.1 of the OIDC 1.0 specification]. Returns a promise that resolves when initialization completes. diff --git a/js/libs/keycloak-js/dist/keycloak.d.ts b/js/libs/keycloak-js/dist/keycloak.d.ts index 075082c397..d0acd606cb 100644 --- a/js/libs/keycloak-js/dist/keycloak.d.ts +++ b/js/libs/keycloak-js/dist/keycloak.d.ts @@ -195,6 +195,12 @@ export interface KeycloakInitOptions { * @default 10000 */ messageReceiveTimeout?: number + + /** + * When onLoad is 'login-required', sets the 'ui_locales' query param in compliance with section 3.1.2.1 + * of the OIDC 1.0 specification. + */ + locale?: string; } export interface KeycloakLoginOptions { diff --git a/js/libs/keycloak-js/src/keycloak.js b/js/libs/keycloak-js/src/keycloak.js index 2287ac3747..fe046913d1 100755 --- a/js/libs/keycloak-js/src/keycloak.js +++ b/js/libs/keycloak-js/src/keycloak.js @@ -176,6 +176,9 @@ function Keycloak (config) { options.prompt = 'none'; } + if (initOptions && initOptions.locale) { + options.locale = initOptions.locale; + } kc.login(options).then(function () { initPromise.setSuccess(); }).catch(function (error) {