question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
legatekcommented, Jun 22, 2018

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?

2reactions
atom-morgancommented, Aug 10, 2018

I’m seeing the same behavior as @srudolph-credera on v.2.0.0.

If a JWT doesn’t have an exp then isTokenExpired always returns true.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found