Angular2-jwt: The inspected token doesn't appear to be a JWT

Created on 21 Feb 2018  ·  5Comments  ·  Source: auth0/angular2-jwt

Hi

Using angular-jwt with Angular 5 I'm getting Error: The inspected token doesn't appear to be a JWT when trying checking the token expiration with isTokenExpired('refresh_token')

The token is valid according to jwt.io
capture d ecran 2018-02-21 a 10 41 19

I got the same error in my interceptor while doing
this.jwtHelper.isTokenExpired('access_token')

By simply having this.jwtHelper.isTokenExpired() in my interceptor it works (though I'm not sure of the behavior ....) but in the case of the refresh I absolutely need to check the refresh token (otherwise it'd be non-sense).

I can't seem to find a solution to this :)

stale

Most helpful comment

@maikdiepenbroek I had the same issue as OP, and that was the cause. Good catch, thank you.

All 5 comments

Not sure if you're not already doing this but are you getting the token before checking it ?

like

const refreshToken = tokenGetter();
this.jwtHelper.isTokenExpired(refreshToken)

@maikdiepenbroek I had the same issue as OP, and that was the cause. Good catch, thank you.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! 🙇‍♂️

I had the same problem but can not find a solution

@maikdiepenbroek thank you it did solve my issue

Was this page helpful?
0 / 5 - 0 ratings