i am new to angular and i just trying implement the basic usage right now and i cant figure out where to start.
Environment
i am using angular 8 and the latest version of this package
`angular
.module('app', ['angular-jwt'])
.config(function Config($httpProvider, jwtOptionsProvider) {
// Please note we're annotating the function so that the $injector works when the file is minified
jwtOptionsProvider.config({
tokenGetter: ['myService', function(myService) {
myService.doSomething();
return localStorage.getItem('id_token');
}]
});
})
.controller('Controller', function Controller($http) {
// If localStorage contains the id_token it will be sent in the request
// Authorization: Bearer [yourToken] will be sent
$http({
url: '/hola',
method: 'GET'
});
});`
where do i use this code? how to use it? where do i paste it?
Key Features:
.....
Automatically send the JWT in every request made to the server
how to make the http interceptor work automatically?
Description
i need help to implement this package.
i am new to angular and i just trying implement the basic usage right now and i cant figure out where to start.
Environment
i am using angular 8 and the latest version of this package
`angular .module('app', ['angular-jwt']) .config(function Config($httpProvider, jwtOptionsProvider) { // Please note we're annotating the function so that the $injector works when the file is minified jwtOptionsProvider.config({ tokenGetter: ['myService', function(myService) { myService.doSomething(); return localStorage.getItem('id_token'); }] });
}) .controller('Controller', function Controller($http) { // If localStorage contains the id_token it will be sent in the request // Authorization: Bearer [yourToken] will be sent $http({ url: '/hola', method: 'GET' }); });`
where do i use this code? how to use it? where do i paste it?
Key Features: ..... Automatically send the JWT in every request made to the server
how to make the http interceptor work automatically?