Always returns isExpired as true. Had to rollback to angular2-jwt to make it work properly.
See original GitHub issue` isLoggedIn(){ const jwtHelper = new JwtHelperService(); let token = localStorage.getItem(‘token’);
if (!token) {
return false;
} else {
let expDate = jwtHelper.getTokenExpirationDate(token);
let isExpired = jwtHelper.isTokenExpired(token);
console.log('Expiration Date',expDate);
console.log('isExpired',isExpired);
return !isExpired;
}
}`
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Always returns isExpired as true. Had to rollback to angular2 ...
Always returns isExpired as true. Had to rollback to angular2-jwt to make it work properly.
Read more >Angular6 auth0/angular2-jwt isTokenExpired function always ...
angular - Angular6 auth0/angular2-jwt isTokenExpired function always return false if we valid Token - Stack Overflow. Stack Overflow for Teams ...
Read more >Check if JWT token is expired using Angular JWT library
Playlist: https://www.youtube.com/watch?v=rcq4SlD2JLY&list=PLV-DQnYj14bSeWaCLxBtHICMJx2nFTmlLInstall angular2-jwt : ...
Read more >Updates to Angular documentation / samples needed
This post is mainly a small set of opinions I have about how the current documentation and sample code, for web SPA clients...
Read more >@auth0/angular-jwt - npm
This library does not have any functionality for (or opinion about) ... The tokenGetter is a function which returns the user's token.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is the commit that changed the behavior quite explicitly:
https://github.com/auth0/angular2-jwt/commit/ce750feddf7073aedc73f024b7fe962471eabcf7#diff-b827188f6870a4e92c47864505a1fd95
The code change appears to be inconsistent with the RFC, in that the exp claim is optional (https://tools.ietf.org/html/rfc7519#section-4.1.4).
Can we get this change reverted?
I’m seeing the same behavior as @srudolph-credera on v.2.0.0.
If a JWT doesn’t have an
exp
thenisTokenExpired
always returns true.