Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help needed to implement the basic functions #193

Closed
iteniasim opened this issue Nov 5, 2019 · 1 comment
Closed

Help needed to implement the basic functions #193

iteniasim opened this issue Nov 5, 2019 · 1 comment

Comments

@iteniasim
Copy link

iteniasim commented Nov 5, 2019

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');
}]
});

$httpProvider.interceptors.push('jwtInterceptor');

})
.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?

@gabrieleciech
Copy link

Hi @iteniasim, this module is intended for AngularJS only, for Angular you need to look at https://github.com/auth0/angular2-jwt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants