Skip to content

Instantly share code, notes, and snippets.

@jwalsh
Last active November 10, 2017 19:18
Show Gist options
  • Select an option

  • Save jwalsh/5cb4dc4164b7666dae61a8e6bee409c6 to your computer and use it in GitHub Desktop.

Select an option

Save jwalsh/5cb4dc4164b7666dae61a8e6bee409c6 to your computer and use it in GitHub Desktop.
Math.floor(((function parseJwt(token) {
let base64Url = token.split('.')[1];
let base64 = base64Url.replace('-', '+').replace('_', '/');
return JSON.parse(window.atob(base64));
})(window.localStorage.getItem('access_token')).exp - new Date() / 1000) / 60)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment