From eb160b67d197dae574383b4dac7ce5f7d3114be6 Mon Sep 17 00:00:00 2001 From: erdemcaygor Date: Fri, 30 May 2025 10:06:36 +0300 Subject: [PATCH] code flow authentication update --- .../src/lib/strategies/auth-code-flow-strategy.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/npm/ng-packs/packages/oauth/src/lib/strategies/auth-code-flow-strategy.ts b/npm/ng-packs/packages/oauth/src/lib/strategies/auth-code-flow-strategy.ts index d9f86271b8..289a26099a 100644 --- a/npm/ng-packs/packages/oauth/src/lib/strategies/auth-code-flow-strategy.ts +++ b/npm/ng-packs/packages/oauth/src/lib/strategies/auth-code-flow-strategy.ts @@ -1,4 +1,4 @@ -import { Inject, PLATFORM_ID } from '@angular/core'; +import { Injector, PLATFORM_ID } from '@angular/core'; import { noop } from '@abp/ng.core'; import { Params } from '@angular/router'; import { filter, from, of, take, tap } from 'rxjs'; @@ -8,7 +8,12 @@ import { isPlatformBrowser } from '@angular/common'; export class AuthCodeFlowStrategy extends AuthFlowStrategy { readonly isInternalAuth = false; - @Inject(PLATFORM_ID) platformId: string; + private platformId: object; + + constructor(protected injector: Injector) { + super(injector); + this.platformId = injector.get(PLATFORM_ID); + } async init() { this.checkRememberMeOption(); @@ -69,6 +74,7 @@ export class AuthCodeFlowStrategy extends AuthFlowStrategy { } protected listenToTokenReceived() { + console.log('listenToTokenReceived'); if (isPlatformBrowser(this.platformId)) { this.oAuthService.events .pipe( @@ -84,6 +90,8 @@ export class AuthCodeFlowStrategy extends AuthFlowStrategy { } navigateToLogin(queryParams?: Params) { + console.log('navigateToLogin'); + console.log(isPlatformBrowser(this.platformId)); if (isPlatformBrowser(this.platformId)) { let additionalState = ''; if (queryParams?.returnUrl) { @@ -96,6 +104,7 @@ export class AuthCodeFlowStrategy extends AuthFlowStrategy { } checkIfInternalAuth(queryParams?: Params) { + console.log('checkIfInternalAuth'); if (isPlatformBrowser(this.platformId)) { this.oAuthService.initCodeFlow('', this.getCultureParams(queryParams)); return false; @@ -112,6 +121,8 @@ export class AuthCodeFlowStrategy extends AuthFlowStrategy { } login(queryParams?: Params) { + console.log('login'); + console.log(isPlatformBrowser(this.platformId)); if (isPlatformBrowser(this.platformId)) { this.oAuthService.initCodeFlow('', this.getCultureParams(queryParams)); return of(null);