`getIsAuthorized` function never returns true in IE and Edge
See original GitHub issueHi,
We have problem with getIsAuthorized
function in IE and Edge. This function never returns true
when we use it in auth guard.
In Chrome everything works fine. (That means, after login on Identity Server, getIsAuthorized
is false
and Chrome redirect to unauthorized page, but in less than one sec getIsAuthorized
returns true
and Chrome redirect to app).
In IE we never get true
value after redirect from Identity Server. We tried debug it in IE, but console is closing and cleaning because of redirecting.
We allowed everything what we need in polyfills.ts
including 'isomorphic-fetch'
.
Can you help us?
Thanks
Our code:
auth.guard.ts
canActivate(
next: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean> | boolean {
return this.oidcSecurityService.getIsAuthorized().pipe(
map((isAuthorized: boolean) => {
if (isAuthorized) { return true; }
this.router.navigate(['/unauthorized']);
return false;
})
);
}
app-routing.module.ts
Routes = [
{
path: '', component: ShellComponent,
canActivate: [AuthGuard],
canActivateChild: [AuthGuard],
children: [
{ path: 'programs', loadChildren: './programs/programs.module#ProgramsModule', canLoad: [AuthGuard] },
{ path: '', component: DashboardComponent, pathMatch: 'full' }
]
},
{ path: 'unauthorized', component: UnauthorizedComponent },
{ path: 'callback', redirectTo: ''},
{ path: 'id_token', redirectTo: '' },
{ path: '**', component: UnauthorizedComponent }
];
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Issues on Internet Explorer & Microsoft Edge (MSAL.js)
Learn about know issues when using the Microsoft Authentication Library for JavaScript (MSAL.js) with Internet Explorer and Microsoft Edge ...
Read more >Javascript Function not working in Edge - Stack Overflow
It works out fine in Chrome, Firefox and Opera, but not in Safari, IE and Edge... Is there something incompatible with the Browser?...
Read more >angular-auth-oidc-client - Bountysource
getIsAuthorized () method to check the authoriziation however it is returning isAuthorized as successful. due to which the client application is getting ...
Read more >angular/angular - Gitter
I have a component I want to nest in another component. My child component has, [(ngModel)]="ngModel" (ngModelChange)="ngModelChange($event)” . How do I expose ...
Read more >Microsoft Edge not opening Internet Explorer | SHARE
To return Internet Explorer to its normal function, follow the steps below. In Microsoft Edge. 1 Click the 3 dots in the upper...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for feedback. We know how to open IE console but IE close our console when redirecting from Identity server to our angular app. (We read about this, and IE is starting new threads. ) Side effect is also cleaning and closing debug console.
(It looks like session storage is cleaned too, because we tried set storage to
localStorage
and after that it looks like it works correct.My guess is that this is/was a timing issue and getIsAuthorized() was being called by the guard before module setup was completed.
This should be fixed in recent versions (7.0.2+). Could you try it again?
getIsAuthorized() will now wait until setup is completed before emitting.