Skip to content

Instantly share code, notes, and snippets.

Avatar

Mark Lagendijk marklagendijk

View GitHub Profile
View jwt-decode.js
var jwt = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0b3B0YWwuY29tIiwiZXhwIjoxNDI2NDIwODAwLCJodHRwOi8vdG9wdGFsLmNvbS9qd3RfY2xhaW1zL2lzX2FkbWluIjp0cnVlLCJjb21wYW55IjoiVG9wdGFsIiwiYXdlc29tZSI6dHJ1ZX0.yRQYnWzskCZUxPwaQupWkiUzKELZ49eM7oWxAQK_ZXw';
console.log(decodeJsonWebToken(jwt));
function decodeJsonWebToken(token){
var tokenParts = token.split('.');
return {
header: decodeTokenPart(tokenParts[0]),
token: decodeTokenPart(tokenPart[1]),
signature: tokenPart[2]
};
@marklagendijk
marklagendijk / default-interpolation.js
Last active Aug 29, 2015
Angular Translate sanitizing proposal
View default-interpolation.js
/**
* @ngdoc object
* @name pascalprecht.translate.$translateDefaultInterpolation
* @requires $interpolate
*
* @description
* Uses angular's `$interpolate` services to interpolate strings against some values.
*
* @return {object} $translateInterpolator Interpolator service
*/
You can’t perform that action at this time.