diff --git a/projects/lib/src/oauth-service.ts b/projects/lib/src/oauth-service.ts index e78bc8a3..7ef9e7f0 100644 --- a/projects/lib/src/oauth-service.ts +++ b/projects/lib/src/oauth-service.ts @@ -845,6 +845,7 @@ export class OAuthService extends AuthConfig { const redirectUri = this.silentRefreshRedirectUri || this.redirectUri; this.createLoginUrl(null, null, redirectUri, noPrompt, params).then(url => { iframe.setAttribute('src', url); + if (!this.silentRefreshShowIFrame) { iframe.style['display'] = 'none'; } @@ -1703,7 +1704,8 @@ export class OAuthService extends AuthConfig { if (noRedirectToLogoutUrl) { return; } - if (!id_token) { + + if (!id_token && !this.postLogoutRedirectUri) { return; } @@ -1721,13 +1723,22 @@ export class OAuthService extends AuthConfig { .replace(/\{\{id_token\}\}/, id_token) .replace(/\{\{client_id\}\}/, this.clientId); } else { + + let params = new HttpParams(); + + if (id_token) { + params = params.set('id_token_hint', id_token); + } + + const postLogoutUrl = this.postLogoutRedirectUri || this.redirectUri; + if (postLogoutUrl) { + params = params.set('post_logout_redirect_uri', postLogoutUrl); + } + logoutUrl = this.logoutUrl + (this.logoutUrl.indexOf('?') > -1 ? '&' : '?') + - 'id_token_hint=' + - encodeURIComponent(id_token) + - '&post_logout_redirect_uri=' + - encodeURIComponent(this.postLogoutRedirectUri || this.redirectUri); + params.toString() } location.href = logoutUrl; } diff --git a/projects/sample/src/app/auth.config.ts b/projects/sample/src/app/auth.config.ts index ed3f6fb3..f9cafa98 100644 --- a/projects/sample/src/app/auth.config.ts +++ b/projects/sample/src/app/auth.config.ts @@ -19,6 +19,8 @@ export const authConfig: AuthConfig = { // The first three are defined by OIDC. The 4th is a usecase-specific one scope: 'openid profile email voucher', + // silentRefreshShowIFrame: true, + showDebugInformation: true, sessionChecksEnabled: false