Issues with the Angular2 Quickstart

The quick start tutorial has various issues if you are trying to use this with the angular-cli which if you are using Angular (4) you should be. Including issues with the AUTH_PROVIDERS not working, however there are other workarounds for this.

Another of the issues is that the use of angular2-jwt is incorrect and does not work. There’s an issue where tokenNotExpired always returns false.

As a workaround to the tokenNotExpired issue you can:

  • Rename the storage item; change from id_token to token


  • Change the call to tokenNotExpired to use the key name used for local storage:

    public authenticated() {
    return tokenNotExpired(‘id_token’);

The content above was originally provided by @g.duffield in the question body itself, I’m providing it as an answer for discoverability reasons.

@g.duffield I provided your workarounds for the tokenNotExpired issue as an answer so that’s it’s easier to locate. If you want you can provide it as your own answer and I’ll delete mine. Thanks for taking the time to document this.