auth0 / angular-jwt

Library to help you work with JWTs on AngularJS
MIT License
0 stars 1 forks source link

Help needed to implement the basic functions #193

Closed iteniasim closed 4 years ago

iteniasim commented 4 years ago

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 commented 4 years ago

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