Throw an exception if init() is called more than once (#20722)

Closes #12745
This commit is contained in:
Alexander Makarenko 2023-07-03 14:38:49 +02:00 committed by GitHub
parent a31352aa18
commit 22fe316b3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -49,6 +49,12 @@ function Keycloak (config) {
var logWarn = createLogger(console.warn);
kc.init = function (initOptions) {
if (kc.didInitialize) {
throw new Error("A 'Keycloak' instance can only be initialized once.");
}
kc.didInitialize = true;
kc.authenticated = false;
callbackStorage = createCallbackStorage();