diff --git a/adapters/oidc/js/src/main/resources/keycloak.d.ts b/adapters/oidc/js/src/main/resources/keycloak.d.ts index 64f1aad1f0..fd306c7dd0 100644 --- a/adapters/oidc/js/src/main/resources/keycloak.d.ts +++ b/adapters/oidc/js/src/main/resources/keycloak.d.ts @@ -546,13 +546,13 @@ declare namespace Keycloak { * still valid, or if the token is no longer valid. * @example * ```js - * keycloak.updateToken(5).success(function(refreshed) { + * keycloak.updateToken(5).then(function(refreshed) { * if (refreshed) { * alert('Token was successfully refreshed'); * } else { * alert('Token is still valid'); * } - * }).error(function() { + * }).catch(function() { * alert('Failed to refresh the token, or the session has expired'); * }); */ diff --git a/examples/broker/facebook-authentication/src/main/webapp/js/app.js b/examples/broker/facebook-authentication/src/main/webapp/js/app.js index 8d012b7462..008c37e310 100755 --- a/examples/broker/facebook-authentication/src/main/webapp/js/app.js +++ b/examples/broker/facebook-authentication/src/main/webapp/js/app.js @@ -20,7 +20,7 @@ var module = angular.module('app', []); angular.element(document).ready(function ($http) { var keycloakAuth = new Keycloak('keycloak.json'); - keycloakAuth.init({ onLoad: 'login-required' }).success(function () { + keycloakAuth.init({ onLoad: 'login-required' }).then(function () { module.factory('Auth', function() { var Auth = {}; @@ -59,8 +59,8 @@ angular.element(document).ready(function ($http) { deferred.resolve(config); if (keycloakAuth.token) { - keycloakAuth.updateToken(5).success(function() { - }).error(function() { + keycloakAuth.updateToken(5).then(function() { + }).catch(function() { deferred.reject('Failed to refresh token'); }); } diff --git a/examples/broker/google-authentication/src/main/webapp/js/app.js b/examples/broker/google-authentication/src/main/webapp/js/app.js index 6135240618..1a20ea37d1 100755 --- a/examples/broker/google-authentication/src/main/webapp/js/app.js +++ b/examples/broker/google-authentication/src/main/webapp/js/app.js @@ -20,7 +20,7 @@ var module = angular.module('app', []); angular.element(document).ready(function ($http) { var keycloakAuth = new Keycloak('keycloak.json'); - keycloakAuth.init({ onLoad: 'login-required' }).success(function () { + keycloakAuth.init({ onLoad: 'login-required' }).then(function () { module.factory('Auth', function() { var Auth = {}; @@ -59,8 +59,8 @@ angular.element(document).ready(function ($http) { deferred.resolve(config); if (keycloakAuth.token) { - keycloakAuth.updateToken(5).success(function() { - }).error(function() { + keycloakAuth.updateToken(5).then(function() { + }).catch(function() { deferred.reject('Failed to refresh token'); }); } @@ -87,7 +87,7 @@ angular.element(document).ready(function ($http) { }); angular.bootstrap(document, ["app"]); - }).error(function () { + }).catch(function () { window.location.reload(); }); }); diff --git a/examples/broker/saml-broker-authentication/src/main/webapp/js/app.js b/examples/broker/saml-broker-authentication/src/main/webapp/js/app.js index e5b9ae6845..b6955d8dae 100755 --- a/examples/broker/saml-broker-authentication/src/main/webapp/js/app.js +++ b/examples/broker/saml-broker-authentication/src/main/webapp/js/app.js @@ -20,7 +20,7 @@ var module = angular.module('app', []); angular.element(document).ready(function ($http) { var keycloakAuth = new Keycloak('keycloak.json'); - keycloakAuth.init({ onLoad: 'login-required' }).success(function () { + keycloakAuth.init({ onLoad: 'login-required' }).then(function () { module.factory('Auth', function() { var Auth = {}; @@ -53,8 +53,8 @@ angular.element(document).ready(function ($http) { deferred.resolve(config); if (keycloakAuth.token) { - keycloakAuth.updateToken(5).success(function() { - }).error(function() { + keycloakAuth.updateToken(5).then(function() { + }).catch(function() { deferred.reject('Failed to refresh token'); }); } @@ -81,7 +81,7 @@ angular.element(document).ready(function ($http) { }); angular.bootstrap(document, ["app"]); - }).error(function () { + }).catch(function () { window.location = keycloakAuth.createLoginUrl({ idpHint: 'saml-identity-provider' }) diff --git a/examples/broker/twitter-authentication/src/main/webapp/js/app.js b/examples/broker/twitter-authentication/src/main/webapp/js/app.js index 9da7d7f60e..631007c121 100755 --- a/examples/broker/twitter-authentication/src/main/webapp/js/app.js +++ b/examples/broker/twitter-authentication/src/main/webapp/js/app.js @@ -20,7 +20,7 @@ var module = angular.module('app', []); angular.element(document).ready(function ($http) { var keycloakAuth = new Keycloak('keycloak.json'); - keycloakAuth.init({ onLoad: 'login-required' }).success(function () { + keycloakAuth.init({ onLoad: 'login-required' }).then(function () { module.factory('Auth', function() { var Auth = {}; @@ -63,8 +63,8 @@ angular.element(document).ready(function ($http) { deferred.resolve(config); if (keycloakAuth.token) { - keycloakAuth.updateToken(5).success(function() { - }).error(function() { + keycloakAuth.updateToken(5).then(function() { + }).catch(function() { deferred.reject('Failed to refresh token'); }); } @@ -91,7 +91,7 @@ angular.element(document).ready(function ($http) { }); angular.bootstrap(document, ["app"]); - }).error(function () { + }).catch(function () { window.location.reload(); }); }); diff --git a/examples/cordova-native/www/index.html b/examples/cordova-native/www/index.html index 67b0db823d..1d9f480183 100644 --- a/examples/cordova-native/www/index.html +++ b/examples/cordova-native/www/index.html @@ -60,7 +60,7 @@ responseMode: 'query', onLoad: 'check-sso', redirectUri: 'android-app://org.keycloak.examples.cordova/https/keycloak-cordova-example.github.io/login' - }).success(updateState).error(error); + }).then(updateState).catch(error); }, false);