File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -161,11 +161,14 @@ export class OAuthService extends AuthConfig {
161161 * about to expire.
162162 * @param params Additional parameter to pass
163163 */
164- public setupAutomaticSilentRefresh ( params : object = { } ) {
164+ public setupAutomaticSilentRefresh ( params : object = { } , listenTo ?: 'access_token' | 'id_token' | 'any' ) {
165165 this . events . pipe ( filter ( e => e . type === 'token_expires' ) ) . subscribe ( e => {
166- this . silentRefresh ( params ) . catch ( _ => {
167- this . debug ( 'Automatic silent refresh did not work' ) ;
168- } ) ;
166+ const event = e as OAuthInfoEvent ;
167+ if ( listenTo == null || listenTo === 'any' || event . info === listenTo ) {
168+ this . silentRefresh ( params ) . catch ( _ => {
169+ this . debug ( 'Automatic silent refresh did not work' ) ;
170+ } ) ;
171+ }
169172 } ) ;
170173
171174 this . restartRefreshTimerIfStillLoggedIn ( ) ;
@@ -942,12 +945,12 @@ export class OAuthService extends AuthConfig {
942945 break ;
943946 case 'changed' :
944947 this . ngZone . run ( ( ) => {
945- this . handleSessionChange ( )
948+ this . handleSessionChange ( ) ;
946949 } ) ;
947950 break ;
948951 case 'error' :
949- this . ngZone . run ( ( ) => {
950- this . handleSessionError ( )
952+ this . ngZone . run ( ( ) => {
953+ this . handleSessionError ( ) ;
951954 } ) ;
952955 break ;
953956 }
@@ -1761,7 +1764,7 @@ export class OAuthService extends AuthConfig {
17611764 logoutUrl =
17621765 this . logoutUrl +
17631766 ( this . logoutUrl . indexOf ( '?' ) > - 1 ? '&' : '?' ) +
1764- params . toString ( )
1767+ params . toString ( ) ;
17651768 }
17661769 location . href = logoutUrl ;
17671770 }
You can’t perform that action at this time.
0 commit comments