Starts in:
0 DAY
5 HRS
55 MIN
36 SEC
Starts in:
0 D
5 H
55 M
36 S
Open Closed

Angular AuthGuard not redirecting to Url of page requested after logging in #170


User avatar
0
wazbek created

HI

I try to browse to a page on our website, say /setting-management but I am not logged in yet. I get redirected to the /account/login screen as expected. I then login but I am not redirected back to the /setting-management page which I first navigated to.

I had a look at the AuthGuard and found this line of code router.navigate(['/account/login'], { state: { redirectUrl: state.url } });

How can I get this to work as expected?


4 Answer(s)
  • User Avatar
    0
    Mehmet created

    Hi

    We'll fix the problem. Until the problem is resolved, you can protect the page via AuthGuard as shown below:

    // app-routing.module.ts
    
    import { ..., AuthGuard } from '@abp/ng.core';
    //...
     {
        path: 'setting-management',
        canActivate: [AuthGuard], // added canActivate
       //...
      }
    
  • User Avatar
    0
    wazbek created

    Hi Mehmet

    Thanks. I am already protecting my routes with the AuthGuard.

    Any idea when this fix will be released?

  • User Avatar
    0
    Mehmet created

    May 21, 2020,

    See the milestones: https://github.com/abpframework/abp/milestones

  • User Avatar
    0
    wazbek created

    Thank you.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06