Created
July 11, 2017 21:42
-
-
Save negherbon/4d878f69e75f02a2fea945e46038dd44 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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