Hello,
Can you inform us about what are your UI type and your ABP version?
Hello,
I created a new project in version 5.2.2 and tried creating an entity with CRUD Page Generator. Everything works fine.
Is there any error in your terminal? Can you send suite logs to understand your case?
Suite logs placed under Windows: %UserProfile%.abp\suite\logs Mac: ~/.abp/suite/logs
Hello,
Yes you can use this.oAuthService.hasValidAccessToken();
for checking user login status. If you change your component's changeDetection to ChangeDetectionStrategy.OnPush
the getter won't call on user interaction events, after async processes. Also, you can check by subscribing configState.getDeep$('currentUser.id')
, if the id is not empty this means the app has authenticated user.
Example
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ConfigStateService } from '@abp/ng.core';
import { map } from 'rxjs/operators';
@Component({
selector: 'app-component',
template:`~~~~
<!-- example with checking user id -->
<div *ngIf="isAuthenticated$ | async; else notAuthenticated">
authenticated
</div>
<ng-template #notAuthenticated>
not authenticated
</ng-template>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class YourComponent {
isAuthenticated$ = this.configState.getDeep$('currentUser.id').pipe(map(Boolean));
constructor(private configState: ConfigStateService) {}
}
event.target.disabled = true;
why did you do that way instead of following way
@Component({
selector: 'app-component',
template: '<button [disabled]="disabled" (click)="makeDisabled()"> myButton </button>'
})
export class YourComponent {
makeDisabled() {
this.disabled = true;
}
}
We can not produce the token refresh error in version 4.3.2. Related video link
Hello,
Sorry for the wrong code example. I checked AuthService in 4.2.2, you can use initLogin
method of AuthService in the subscription
Hello,
Packages can not be re-publish with the existing version to npm. We don't have plans to release a new version for version 4.2.x.
Suppose you don't want to update the ABP version. You can add the following code in your app.component.ts
.
import { Component } from '@angular/core';
import { OAuthService } from 'angular-oauth2-oidc';
import { AuthService } from '@abp/ng.core';
import { filter } from 'rxjs/operators';
@Component({
selector: 'app-root',
template: `<!-- COMPONENT TEMPLATE -->`,
})
export class AppComponent {
constructor(private authService: AuthService, private oAuthService: OAuthService) {
this.oAuthService.events
.pipe(filter(event => event.type === 'token_refresh_error'))
.subscribe(() => this.authService.navigateToLogin());
}
}
Hello,
We fixed navigating to the login page when the token expires in version 4.4 with this pr. Can you update your project to version 4.4 and try your steps again ?
Hello,
Url parameter for angular proxy generation supported in abp cli 5.2.2 and @abp/ng.schematics package version 5.2.2. But there is a bug in version 5.2.2 which is abp generate-proxy command doesn't work without url parameter. It is fixed in 5.3.0-rc.3 and it will be fixed in version 5.2.3. If you update ABP Cli and @abp/ng.schematics package versions to 5.2.2 or 5.3.0-rc.3 you can pass url parameter.
The error seems related to got library. I found a discussions in rxjs repo and found an issue in got library. We will try to understand cause of this error with observing related library issues. By the way are the node versions same in both machines ? Proxy generation works in Macos Catalina, also we will try in Macos Monterey.
Hello,
You can change your APP_INITIALIZER provider with the following provider
import { ConfigStateService } from '@abp/ng.core';
import { APP_INITIALIZER, Injector, NgModule } from '@angular/core';
import { filter, switchMap, take, tap } from 'rxjs/operators';
@NgModule({
declarations: [/* Declarations */],
imports: [ /* Imports */],
providers: [
// other providers
{
provide: APP_INITIALIZER,
multi: true,
deps: [Injector],
useFactory: injector => {
const service = injector.get(YOUR_SERVICE);
const configStateService = injector.get(ConfigStateService);
return () => {
return configStateService
.getOne$('currentTenant')
.pipe(
filter(Boolean),
switchMap(tenant => service.yourMethod(tenant)),
take(1)
)
.toPromise();
};
},
},
]
})
export class AppModule {}
Hello,
With your steps, we can reproduce the wrong state/nonce
error. But after navigating to the identity server, the identity server didn't ask for credentials because the user was still authenticated in the identity server. I opened an issue in the abp repo. You can follow the status of this issue.
Hello,
Both exports in public-api.ts are valid. The difference between these exports export * from './lib/proxy';
wraps a namespace for everything in lib/proxy/product-service
and exports this namespace of service, the other one exports directly lib/proxy/product-service
. You can use export * from './lib/proxy/product-service/index';
in this case because each library includes one microservice proxy. There will not be a conflict of service classes or interfaces