fix broken state when canceling OIDC logout at provider (#2082) (#3201)

This commit is contained in:
ACX
2026-03-06 11:41:49 -07:00
committed by GitHub
parent 1480866fa2
commit e887918077
2 changed files with 7 additions and 1 deletions
@@ -54,6 +54,8 @@ export class LoginComponent implements OnInit {
private static readonly MAX_REDIRECT_COUNT = 3;
ngOnInit(): void {
this.authService.clearSessionOnLoginPage();
this.route.queryParams.pipe(take(1)).subscribe(params => {
if (params['reason'] === 'session_revoked') {
this.infoMessage = this.translocoService.translate('auth.login.sessionRevoked');
@@ -77,10 +77,10 @@ export class AuthService {
const refreshToken = this.getInternalRefreshToken();
this.http.post<{ logoutUrl: string | null }>(`${this.apiUrl}/logout`, {refreshToken}).subscribe({
next: (response) => {
this.clearSession();
if (response.logoutUrl) {
window.location.href = response.logoutUrl;
} else {
this.clearSession();
this.router.navigate(['/login']).then(() => window.location.reload());
}
},
@@ -96,6 +96,10 @@ export class AuthService {
this.router.navigate(['/login'], {queryParams: {reason}});
}
clearSessionOnLoginPage(): void {
this.clearSession();
}
private clearSession(): void {
localStorage.removeItem('accessToken_Internal');
localStorage.removeItem('refreshToken_Internal');