@@ -91,6 +91,10 @@ function init (config, watch, options) {
9191 keycloak . onAuthRefreshSuccess = function ( ) {
9292 updateWatchVariables ( true )
9393 }
94+ keycloak . onAuthRefreshError = function ( ) {
95+ updateWatchVariables ( false )
96+ typeof options . onAuthRefreshError === 'function' && options . onAuthRefreshError . bind ( this , keycloak ) ( )
97+ }
9498 keycloak . init ( options . init )
9599 . error ( err => {
96100 typeof options . onInitError === 'function' && options . onInitError ( err )
@@ -130,7 +134,7 @@ function init (config, watch, options) {
130134}
131135
132136function assertOptions ( options ) {
133- const { config, init, onReady, onInitError} = options
137+ const { config, init, onReady, onInitError, onAuthRefreshError } = options
134138 if ( typeof config !== 'string' && ! _isObject ( config ) ) {
135139 return { hasError : true , error : `'config' option must be a string or an object. Found: '${ config } '` }
136140 }
@@ -143,6 +147,9 @@ function assertOptions (options) {
143147 if ( onInitError && typeof onInitError !== 'function' ) {
144148 return { hasError : true , error : `'onInitError' option must be a function. Found: '${ onInitError } '` }
145149 }
150+ if ( onAuthRefreshError && typeof onAuthRefreshError !== 'function' ) {
151+ return { hasError : true , error : `'onAuthRefreshError' option must be a function. Found: '${ onAuthRefreshError } '` }
152+ }
146153 return {
147154 hasError : false ,
148155 error : null
0 commit comments