canActivate on ionic2?

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;

Can someone give me a hint please?

I am trying to solve authentication with @CanActivate too!


Having the same problem too :frowning:

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


Any pointers would be greatly appreciated…

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

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