canActivate on ionic2?


#1

I tried to use canActivate on ionic2, but it seems to have no effect. I am trying to create an authentication mechanism. The method called on the canActivate is

static requireAuth(): boolean {
    const { auth, router } = AuthRouteHelper;
    console.log('requiring auth');
    if (!auth.authenticated) router.navigate(['/Login']);
    return auth.authenticated;
  }

Ionic 2 Route Guards?
#2

Can someone give me a hint please?


#3

I am trying to solve authentication with @CanActivate too!

Anyone?


#4

Having the same problem too :frowning:

I am using angular2-jwt, and @CanActivate have no effect :frowning:


#5

+1

Any pointers would be greatly appreciated…


#6

Hey guys, I’m struggling with this exact issue too. any help how to get this basic feature of angular working is highly appreciated


#7

Again me, this issue nagged me quite a bit, so after digging and talking to folks at #ionic-v2 I created an SO question and an Issue on GitHub:

Maybe you’ll find it interesting