question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`getIsAuthorized` function never returns true in IE and Edge

See original GitHub issue

Hi,

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:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
majco333commented, Jun 20, 2018

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.

0reactions
profet23commented, Oct 30, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found