Skip to content

Instantly share code, notes, and snippets.

@phatnguyenuit
Created September 16, 2019 07:09
Show Gist options
  • Save phatnguyenuit/3f7553d258b3ab95ca685cca6f2c4f9f to your computer and use it in GitHub Desktop.
Save phatnguyenuit/3f7553d258b3ab95ca685cca6f2c4f9f to your computer and use it in GitHub Desktop.
import jwt_decode from 'jwt-decode';
export const isExpiredToken = token => {
if (!token) return false;
var decoded_jwt = jwt_decode(token);
var current_time = new Date().getTime() / 1000;
return current_time > decoded_jwt.exp;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment