Skip to content

Instantly share code, notes, and snippets.

View JosephScript's full-sized avatar
💭
🚀 Changed my handle to @JosephScript!

Joseph A. Szczesniak JosephScript

💭
🚀 Changed my handle to @JosephScript!
View GitHub Profile
@JosephScript
JosephScript / authService.js
Created September 22, 2015 14:25
This is an AngularJS authentication service for using JSON Web Tokens
app.service('authService', ['$window', function ($window) {
this.parseJwt = function (token) {
if (token) {
var base64Url = token.split('.')[1];
var base64 = base64Url.replace('-', '+').replace('_', '/');
return JSON.parse($window.atob(base64));
} else return {};
};