Skip to content

how to handle token timeout and redirect to login page? #12461

@TonyLuo

Description

@TonyLuo

Ionic version: (check one with "x")
[x ] 3.x

I'm submitting a ... (check one with "x")

[x ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

Expected behavior:

Steps to reproduce:

I would like to handle the token timeout issue, and redirect to the login page, but this.navCtrl.push(LoginPage) doesn't work for me
Related code:

private listenToAuthorizationEvents() {
    this.events.subscribe('user:unauthorized', () => {
     this.redirectToLoginPage();
    });
  }

  private redirectToLoginPage() {
    this.navCtrl.push(LoginPage);

  }

Other information:

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

insert the output from ionic info here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions