diff --git a/projects/lib/src/auth.config.ts b/projects/lib/src/auth.config.ts index 3760e2b5..0b307833 100644 --- a/projects/lib/src/auth.config.ts +++ b/projects/lib/src/auth.config.ts @@ -15,6 +15,12 @@ export class AuthConfig { */ public postLogoutRedirectUri? = ''; + /** + * Defines whether to use 'redirectUri' as a replacement + * of 'postLogoutRedirectUri' if the latter is not set. + */ + public redirectUriAsPostLogoutRedirectUriFallback? = true; + /** * The auth server's endpoint that allows to log * the user in when using implicit flow. diff --git a/projects/lib/src/oauth-service.ts b/projects/lib/src/oauth-service.ts index 6f0bce0f..5f98875f 100644 --- a/projects/lib/src/oauth-service.ts +++ b/projects/lib/src/oauth-service.ts @@ -2380,7 +2380,7 @@ export class OAuthService extends AuthConfig implements OnDestroy { params = params.set('id_token_hint', id_token); } - const postLogoutUrl = this.postLogoutRedirectUri || this.redirectUri; + const postLogoutUrl = this.postLogoutRedirectUri || (this.redirectUriAsPostLogoutRedirectUriFallback && this.redirectUri || ''); if (postLogoutUrl) { params = params.set('post_logout_redirect_uri', postLogoutUrl);