angular2-jwt icon indicating copy to clipboard operation
angular2-jwt copied to clipboard

The inspected token doesn't appear to be a JWT

Open guillaume-skwid opened this issue 8 years ago • 5 comments

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 :)

guillaume-skwid avatar Feb 21 '18 09:02 guillaume-skwid

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 avatar Feb 24 '18 14:02 maikdiepenbroek

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

mlcdf avatar Apr 12 '18 15:04 mlcdf

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! 🙇‍♂️

stale[bot] avatar Oct 26 '19 04:10 stale[bot]

I had the same problem but can not find a solution

bdafahim avatar Mar 17 '20 12:03 bdafahim

@maikdiepenbroek thank you it did solve my issue

hkhabba avatar May 30 '20 22:05 hkhabba