javascript - Errors initiating Angular Authentication using JWTs and jwtInterceptor -
currently, running angular 1.6.6. , angular-jwt 0.1.9. following examples read.me file of angular-jwt auth0 site here "how can send jwt on every request server?". 2 examples vary slightly. angular-jwt docs uses jwtoptionsprovider , auth0 example uses jwtinterceptorprovider in .config section angular controller.
when run code browser console states:
"failed instantiate module controllername due to: error: [$injector:unpr] unknown provider: jwtinterceptorprovider"
the error same jwtinterceptorprovider , jwtoptionsprovider. here code in angular controller, same docs. wanting make code run can understand how use it:
angular .module('app', ['angular-jwt']) .config(function config($httpprovider, jwtoptionsprovider) { jwtoptionsprovider.config({ tokengetter: ['myservice', function(myservice) { myservice.dosomething(); return localstorage.getitem('id_token'); }] }); $httpprovider.interceptors.push('jwtinterceptor'); })
can explain why error occurring , how correct it?
Comments
Post a Comment