Skip to content

Instantly share code, notes, and snippets.

@negherbon
Created July 11, 2017 21:42
Show Gist options
  • Save negherbon/4d878f69e75f02a2fea945e46038dd44 to your computer and use it in GitHub Desktop.
Save negherbon/4d878f69e75f02a2fea945e46038dd44 to your computer and use it in GitHub Desktop.
(function() {
var app = angular.module('app', [
'angular-jwt'
]);
app.config(['$httpProvider', 'jwtInterceptorProvider', 'jwtOptionsProvider',
function($httpProvider, jwtInterceptorProvider, jwtOptionsProvider) {
// JWT
jwtInterceptorProvider.tokenGetter = [function() {
return localStorage.getItem('id_token'); // Will take care of sending the JWT in every request.
}];
jwtOptionsProvider.config({
whiteListedDomains: ['localhost', '*.yourdomain.com']
});
$httpProvider.interceptors.push('jwtInterceptor');
$httpProvider.interceptors.push('authInterceptor');
}
]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment