angular-jwt-auth-module

0.0.13 • Public • Published

angular-jwt-auth-module

Mix auth0/angular-jwt & witoldsz/angular-http-auth to get automatic auth when response code is 401.

DEPRECATED as it's only compatible with AngularJS

NO TESTS


Documentation

Installation

npm i angular-jwt-auth-module

Build

gulp build

Set the login_check URL

angular.module('app', ['...', 'angular-jwt-auth-module', 'http-auth-interceptor'])....
// app.js
.config(function(angularJwtAuthToolsProvider) {
  angularJwtAuthToolsProvider.urlLoginCheck = '/login_check';
})

Custom methods

You can override the angularJwtAuthTools methods.

angular.module('angular-jwt-auth-module', ['angular-jwt', 'angular-jwt-auth-module.tools', 'LocalStorageModule'])
.config(function($httpProvider, jwtInterceptorProvider, angularJwtAuthToolsProvider) {
 
  // Please note we're annotating the function so that the $injector works when the file is minified
  angularJwtAuthToolsProvider.saveToken = ['localStorageService', function(localStorageService) {
     // "this" is set by $injector, https://docs.angularjs.org/api/auto/service/$injector
    localStorageService.set('auth.jwt_token', this);
  }];
 
});

Readme

Keywords

Package Sidebar

Install

npm i angular-jwt-auth-module

Weekly Downloads

0

Version

0.0.13

License

ISC

Unpacked Size

41 kB

Total Files

17

Last publish

Collaborators

  • thibautjudepj