You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, i'm trying to switch from aurelia-authentication to this client.
Need to switch to a implicit client.
But i'm running into some problems.
This is our old code in main.ts:
let authService = aurelia.container.get(AuthService);
aurelia.setRoot(authService.isAuthenticated() ? PLATFORM.moduleName('pages/app/app') : PLATFORM.moduleName('pages/anonymous-pages/app', 'anon'));
Different root if authenticated vs not authenticated.
But with this client:
let openIdConnect = aurelia.container.get(OpenIdConnect) as OpenIdConnect;
let user = await openIdConnect.userManager.getUser();
if (!user || user.expired) {
log.info('INIT MAIN: Not Autenticated', user);
aurelia.setRoot(PLATFORM.moduleName('pages/anonymous-pages/app'));
}
else {
log.info('INIT MAIN: Autenticated!', user);
aurelia.setRoot(PLATFORM.moduleName('pages/app/app'));
}
When returning back from identityserver 4 after a successful login, with a clean browser, then i'm not authenticated ?
If i do a F5 refresh, then i'm authenticated in main,ts / app.ts.
So not authenticated initially in main.ts, not in app.ts activate, when i hit a page in the app, then i'm autenticated.
Also in Preactivate step, then i'm also authenticated.
So how can i fix this ?
How can i check if i'm authenticated in main.ts so i can set different roots ?
Any tips ? Thanks..
The text was updated successfully, but these errors were encountered:
Hi, i'm trying to switch from aurelia-authentication to this client.
Need to switch to a implicit client.
But i'm running into some problems.
This is our old code in main.ts:
let authService = aurelia.container.get(AuthService);
aurelia.setRoot(authService.isAuthenticated() ? PLATFORM.moduleName('pages/app/app') : PLATFORM.moduleName('pages/anonymous-pages/app', 'anon'));
Different root if authenticated vs not authenticated.
But with this client:
let openIdConnect = aurelia.container.get(OpenIdConnect) as OpenIdConnect;
let user = await openIdConnect.userManager.getUser();
if (!user || user.expired) {
log.info('INIT MAIN: Not Autenticated', user);
aurelia.setRoot(PLATFORM.moduleName('pages/anonymous-pages/app'));
}
else {
log.info('INIT MAIN: Autenticated!', user);
aurelia.setRoot(PLATFORM.moduleName('pages/app/app'));
}
When returning back from identityserver 4 after a successful login, with a clean browser, then i'm not authenticated ?
If i do a F5 refresh, then i'm authenticated in main,ts / app.ts.
So not authenticated initially in main.ts, not in app.ts activate, when i hit a page in the app, then i'm autenticated.
Also in Preactivate step, then i'm also authenticated.
So how can i fix this ?
How can i check if i'm authenticated in main.ts so i can set different roots ?
Any tips ? Thanks..
The text was updated successfully, but these errors were encountered: