diff --git a/lib/content-services/src/lib/common/services/discovery-api.service.ts b/lib/content-services/src/lib/common/services/discovery-api.service.ts index 07695ca06d..52e7b87fe8 100644 --- a/lib/content-services/src/lib/common/services/discovery-api.service.ts +++ b/lib/content-services/src/lib/common/services/discovery-api.service.ts @@ -20,7 +20,7 @@ import { from, Observable, throwError, Subject } from 'rxjs'; import { catchError, map, switchMap, filter, take } from 'rxjs/operators'; import { RepositoryInfo, SystemPropertiesRepresentation } from '@alfresco/js-api'; -import { BpmProductVersionModel, AlfrescoApiService, AuthenticationService } from '@alfresco/adf-core'; +import { BpmProductVersionModel, AuthenticationService } from '@alfresco/adf-core'; import { ApiClientsService } from '@alfresco/adf-core/api'; @Injectable({ @@ -34,13 +34,12 @@ export class DiscoveryApiService { ecmProductInfo$ = new Subject(); constructor( - private apiService: AlfrescoApiService, private authenticationService: AuthenticationService, private apiClientsService: ApiClientsService ) { this.authenticationService.onLogin .pipe( - filter(() => this.apiService.getInstance()?.isEcmLoggedIn()), + filter(() => this.authenticationService.isEcmLoggedIn()), take(1), switchMap(() => this.getEcmProductInfo()) ) diff --git a/lib/core/src/lib/auth/oidc/oidc-authentication.service.ts b/lib/core/src/lib/auth/oidc/oidc-authentication.service.ts index ee400af07e..944260410d 100644 --- a/lib/core/src/lib/auth/oidc/oidc-authentication.service.ts +++ b/lib/core/src/lib/auth/oidc/oidc-authentication.service.ts @@ -46,6 +46,13 @@ export class OIDCAuthenticationService extends BaseAuthenticationService { private readonly auth: AuthService ) { super(alfrescoApi, appConfig, cookie, logService); + this.alfrescoApi.alfrescoApiInitialized.subscribe(() => { + this.oauthService.events.pipe( + filter((event)=> event.type === 'token_received') + ).subscribe(()=>{ + this.onLogin.next(); + }); + }); } isEcmLoggedIn(): boolean {