Skip to content

Commit 2c6ba16

Browse files
committed
1 parent 8766c4d commit 2c6ba16

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

projects/lib/src/oauth-service.ts

+16-5
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,7 @@ export class OAuthService extends AuthConfig {
845845
const redirectUri = this.silentRefreshRedirectUri || this.redirectUri;
846846
this.createLoginUrl(null, null, redirectUri, noPrompt, params).then(url => {
847847
iframe.setAttribute('src', url);
848+
848849
if (!this.silentRefreshShowIFrame) {
849850
iframe.style['display'] = 'none';
850851
}
@@ -1703,7 +1704,8 @@ export class OAuthService extends AuthConfig {
17031704
if (noRedirectToLogoutUrl) {
17041705
return;
17051706
}
1706-
if (!id_token) {
1707+
1708+
if (!id_token && !this.postLogoutRedirectUri) {
17071709
return;
17081710
}
17091711

@@ -1721,13 +1723,22 @@ export class OAuthService extends AuthConfig {
17211723
.replace(/\{\{id_token\}\}/, id_token)
17221724
.replace(/\{\{client_id\}\}/, this.clientId);
17231725
} else {
1726+
1727+
let params = new HttpParams();
1728+
1729+
if (id_token) {
1730+
params = params.set('id_token_hint', id_token);
1731+
}
1732+
1733+
const postLogoutUrl = this.postLogoutRedirectUri || this.redirectUri;
1734+
if (postLogoutUrl) {
1735+
params = params.set('post_logout_redirect_uri', postLogoutUrl);
1736+
}
1737+
17241738
logoutUrl =
17251739
this.logoutUrl +
17261740
(this.logoutUrl.indexOf('?') > -1 ? '&' : '?') +
1727-
'id_token_hint=' +
1728-
encodeURIComponent(id_token) +
1729-
'&post_logout_redirect_uri=' +
1730-
encodeURIComponent(this.postLogoutRedirectUri || this.redirectUri);
1741+
params.toString()
17311742
}
17321743
location.href = logoutUrl;
17331744
}

projects/sample/src/app/auth.config.ts

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ export const authConfig: AuthConfig = {
1919
// The first three are defined by OIDC. The 4th is a usecase-specific one
2020
scope: 'openid profile email voucher',
2121

22+
// silentRefreshShowIFrame: true,
23+
2224
showDebugInformation: true,
2325

2426
sessionChecksEnabled: false

0 commit comments

Comments
 (0)