Skip to content

Commit

Permalink
feat(automatic silent refresh): stopAutomaticRefresh stops all timers.
Browse files Browse the repository at this point in the history
To restart them, call setupAutomaticSilentRefresh again.
  • Loading branch information
manfredsteyer committed Mar 23, 2020
1 parent 0d15d6a commit 8ab853b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion projects/lib/src/auth.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export class AuthConfig {
public nonceStateSeparator? = ';';

/**
* Set this to true to use HTTP BASIC auth for password flow
* Set this to true to use HTTP BASIC auth for AJAX calls
*/
public useHttpBasicAuth? = false;

Expand Down
9 changes: 9 additions & 0 deletions projects/lib/src/oauth-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,15 @@ export class OAuthService extends AuthConfig implements OnDestroy {
});
}

/**
* Stops timers for automatic refresh.
* To restart it, call setupAutomaticSilentRefresh again.
*/
public stopAutomaticRefresh() {
this.clearAccessTokenTimer();
this.clearIdTokenTimer();
}

protected clearAccessTokenTimer(): void {
if (this.accessTokenTimeoutSubscription) {
this.accessTokenTimeoutSubscription.unsubscribe();
Expand Down

0 comments on commit 8ab853b

Please sign in to comment.