Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@auth0/angular-jwt

Package Overview
Dependencies
Maintainers
48
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@auth0/angular-jwt - npm Package Compare versions

Comparing version 5.0.2 to 5.1.0

1

auth0-angular-jwt.d.ts
/**
* Generated bundle index. Do not edit.
*/
/// <amd-module name="@auth0/angular-jwt" />
export * from './index';

131

bundles/auth0-angular-jwt.umd.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('rxjs/operators'), require('rxjs'), require('@angular/common/http')) :
typeof define === 'function' && define.amd ? define('@auth0/angular-jwt', ['exports', '@angular/core', '@angular/common', 'rxjs/operators', 'rxjs', '@angular/common/http'], factory) :
(global = global || self, factory((global.auth0 = global.auth0 || {}, global.auth0['angular-jwt'] = {}), global.ng.core, global.ng.common, global.rxjs.operators, global.rxjs, global.ng.common.http));
}(this, (function (exports, core, common, operators, rxjs, http) { 'use strict';
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.auth0 = global.auth0 || {}, global.auth0["angular-jwt"] = {}), global.ng.core, global.ng.common, global.rxjs.operators, global.rxjs, global.ng.common.http));
})(this, (function (exports, i0, common, operators, rxjs, http) { 'use strict';
var JWT_OPTIONS = new core.InjectionToken('JWT_OPTIONS');
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
var JWT_OPTIONS = new i0.InjectionToken('JWT_OPTIONS');
// tslint:disable:no-bitwise

@@ -16,3 +36,3 @@ var JwtHelperService = /** @class */ (function () {

JwtHelperService.prototype.urlBase64Decode = function (str) {
var output = str.replace(/-/g, "+").replace(/_/g, "/");
var output = str.replace(/-/g, '+').replace(/_/g, '/');
switch (output.length % 4) {

@@ -23,11 +43,11 @@ case 0: {

case 2: {
output += "==";
output += '==';
break;
}
case 3: {
output += "=";
output += '=';
break;
}
default: {
throw new Error("Illegal base64url string!");
throw new Error('Illegal base64url string!');
}

@@ -39,5 +59,5 @@ }

JwtHelperService.prototype.b64decode = function (str) {
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var output = "";
str = String(str).replace(/=+$/, "");
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
var output = '';
str = String(str).replace(/=+$/, '');
if (str.length % 4 === 1) {

@@ -67,12 +87,12 @@ throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");

.call(this.b64decode(str), function (c) {
return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
})
.join(""));
.join(''));
};
JwtHelperService.prototype.decodeToken = function (token) {
if (token === void 0) { token = this.tokenGetter(); }
if (!token || token === "") {
if (!token || token === '') {
return null;
}
var parts = token.split(".");
var parts = token.split('.');
if (parts.length !== 3) {

@@ -83,3 +103,3 @@ throw new Error("The inspected token doesn't appear to be a JWT. Check to make sure it has three parts and see https://jwt.io for more.");

if (!decoded) {
throw new Error("Cannot decode the token.");
throw new Error('Cannot decode the token.');
}

@@ -92,3 +112,3 @@ return JSON.parse(decoded);

decoded = this.decodeToken(token);
if (!decoded || !decoded.hasOwnProperty("exp")) {
if (!decoded || !decoded.hasOwnProperty('exp')) {
return null;

@@ -102,3 +122,3 @@ }

if (token === void 0) { token = this.tokenGetter(); }
if (!token || token === "") {
if (!token || token === '') {
return true;

@@ -114,3 +134,3 @@ }

JwtHelperService.prototype.getAuthScheme = function (authScheme, request) {
if (typeof authScheme === "function") {
if (typeof authScheme === 'function') {
return authScheme(request);

@@ -122,8 +142,12 @@ }

}());
JwtHelperService.decorators = [
{ type: core.Injectable }
];
JwtHelperService.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: core.Inject, args: [JWT_OPTIONS,] }] }
]; };
JwtHelperService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: JwtHelperService, deps: [{ token: JWT_OPTIONS }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
JwtHelperService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: JwtHelperService });
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: JwtHelperService, decorators: [{
type: i0.Injectable
}], ctorParameters: function () {
return [{ type: undefined, decorators: [{
type: i0.Inject,
args: [JWT_OPTIONS]
}] }];
} });

@@ -134,9 +158,9 @@ var JwtInterceptor = /** @class */ (function () {

this.document = document;
this.standardPorts = ["80", "443"];
this.standardPorts = ['80', '443'];
this.tokenGetter = config.tokenGetter;
this.headerName = config.headerName || "Authorization";
this.headerName = config.headerName || 'Authorization';
this.authScheme =
config.authScheme || config.authScheme === ""
config.authScheme || config.authScheme === ''
? config.authScheme
: "Bearer ";
: 'Bearer ';
this.allowedDomains = config.allowedDomains || [];

@@ -156,5 +180,5 @@ this.disallowedRoutes = config.disallowedRoutes || [];

var hostName = "" + requestUrl.hostname + (requestUrl.port && !this.standardPorts.includes(requestUrl.port)
? ":" + requestUrl.port
: "");
return (this.allowedDomains.findIndex(function (domain) { return typeof domain === "string"
? ':' + requestUrl.port
: '');
return (this.allowedDomains.findIndex(function (domain) { return typeof domain === 'string'
? domain === hostName

@@ -169,3 +193,3 @@ : domain instanceof RegExp

return (this.disallowedRoutes.findIndex(function (route) {
if (typeof route === "string") {
if (typeof route === 'string') {
var parsedRoute = new URL(route, _this.document.location.origin);

@@ -186,3 +210,3 @@ return (parsedRoute.hostname === requestedUrl.hostname &&

if (!token && this.throwNoTokenError) {
throw new Error("Could not get token from tokenGetter function.");
throw new Error('Could not get token from tokenGetter function.');
}

@@ -221,10 +245,15 @@ if (this.skipWhenExpired) {

}());
JwtInterceptor.decorators = [
{ type: core.Injectable }
];
JwtInterceptor.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: core.Inject, args: [JWT_OPTIONS,] }] },
{ type: JwtHelperService },
{ type: Document, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] }
]; };
JwtInterceptor.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: JwtInterceptor, deps: [{ token: JWT_OPTIONS }, { token: JwtHelperService }, { token: common.DOCUMENT }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
JwtInterceptor.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: JwtInterceptor });
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: JwtInterceptor, decorators: [{
type: i0.Injectable
}], ctorParameters: function () {
return [{ type: undefined, decorators: [{
type: i0.Inject,
args: [JWT_OPTIONS]
}] }, { type: JwtHelperService }, { type: Document, decorators: [{
type: i0.Inject,
args: [common.DOCUMENT]
}] }];
} });

@@ -256,8 +285,14 @@ var JwtModule = /** @class */ (function () {

}());
JwtModule.decorators = [
{ type: core.NgModule }
];
JwtModule.ctorParameters = function () { return [
{ type: JwtModule, decorators: [{ type: core.Optional }, { type: core.SkipSelf }] }
]; };
JwtModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: JwtModule, deps: [{ token: JwtModule, optional: true, skipSelf: true }], target: i0__namespace.ɵɵFactoryTarget.NgModule });
JwtModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: JwtModule });
JwtModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: JwtModule });
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: JwtModule, decorators: [{
type: i0.NgModule
}], ctorParameters: function () {
return [{ type: JwtModule, decorators: [{
type: i0.Optional
}, {
type: i0.SkipSelf
}] }];
} });

@@ -279,3 +314,3 @@ /*

})));
}));
//# sourceMappingURL=auth0-angular-jwt.umd.js.map
# Change log
## Version [5.1.0](https://github.com/auth0/angular2-jwt/tags/v5.1.0)
[Full Changelog](https://github.com/auth0/angular2-jwt/compare/v5.0.2..v5.1.0)
**Changed**
- Compile using Ivy partial mode [#735](https://github.com/auth0/angular2-jwt/pull/735) ([frederikprijck](https://github.com/frederikprijck))
Note: This release drops support for Angular <12 as [those versions are no longer supported by Google themselves](https://angular.io/guide/releases#actively-supported-versions). [[Read more ...](https://github.com/auth0/angular2-jwt/issues/712#issuecomment-1265009015)]
## Version [5.0.2](https://github.com/auth0/angular2-jwt/tags/v5.0.2)
[Full Changelog](https://github.com/auth0/angular2-jwt/compare/v5.0.1..v5.0.2)
- Update `decodeToken` helper type definition to accept a generic.
## Version [5.0.1](https://github.com/auth0/angular2-jwt/tags/v5.0.1)

@@ -4,0 +20,0 @@

@@ -1,10 +0,11 @@

import { NgModule, Optional, SkipSelf, } from "@angular/core";
import { HTTP_INTERCEPTORS } from "@angular/common/http";
import { JwtInterceptor } from "./jwt.interceptor";
import { JWT_OPTIONS } from "./jwtoptions.token";
import { JwtHelperService } from "./jwthelper.service";
import { NgModule, Optional, SkipSelf, } from '@angular/core';
import { HTTP_INTERCEPTORS } from '@angular/common/http';
import { JwtInterceptor } from './jwt.interceptor';
import { JWT_OPTIONS } from './jwtoptions.token';
import { JwtHelperService } from './jwthelper.service';
import * as i0 from "@angular/core";
export class JwtModule {
constructor(parentModule) {
if (parentModule) {
throw new Error("JwtModule is already loaded. It should only be imported in your application's main module.");
throw new Error(`JwtModule is already loaded. It should only be imported in your application's main module.`);
}

@@ -30,8 +31,12 @@ }

}
JwtModule.decorators = [
{ type: NgModule }
];
JwtModule.ctorParameters = () => [
{ type: JwtModule, decorators: [{ type: Optional }, { type: SkipSelf }] }
];
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5ndWxhci1qd3QubW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvYW5ndWxhci1qd3Qvc3JjL2xpYi9hbmd1bGFyLWp3dC5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNMLFFBQVEsRUFFUixRQUFRLEVBQ1IsUUFBUSxHQUVULE1BQU0sZUFBZSxDQUFDO0FBQ3ZCLE9BQU8sRUFBZSxpQkFBaUIsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ3RFLE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUNuRCxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDakQsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFvQnZELE1BQU0sT0FBTyxTQUFTO0lBQ3BCLFlBQW9DLFlBQXVCO1FBQ3pELElBQUksWUFBWSxFQUFFO1lBQ2hCLE1BQU0sSUFBSSxLQUFLLENBQ2IsNEZBQTRGLENBQzdGLENBQUM7U0FDSDtJQUNILENBQUM7SUFDRCxNQUFNLENBQUMsT0FBTyxDQUFDLE9BQXlCO1FBQ3RDLE9BQU87WUFDTCxRQUFRLEVBQUUsU0FBUztZQUNuQixTQUFTLEVBQUU7Z0JBQ1Q7b0JBQ0UsT0FBTyxFQUFFLG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J1ZSxcbiAgICAgICAgfSxcbiAgICAgICAgb3B0aW9ucy5qd3RPcHRpb25zUHJvdmlkZXIgfHwge1xuICAgICAgICAgIHByb3ZpZGU6IEpXVF9PUFRJT05TLFxuICAgICAgICAgIHVzZVZhbHVlOiBvcHRpb25zLmNvbmZpZyxcbiAgICAgICAgfSxcbiAgICAgICAgSnd0SGVscGVyU2VydmljZSxcbiAgICAgIF0sXG4gICAgfTtcbiAgfVxufVxuIl19
JwtModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: JwtModule, deps: [{ token: JwtModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule });
JwtModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: JwtModule });
JwtModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: JwtModule });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: JwtModule, decorators: [{
type: NgModule
}], ctorParameters: function () { return [{ type: JwtModule, decorators: [{
type: Optional
}, {
type: SkipSelf
}] }]; } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW5ndWxhci1qd3QubW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvYW5ndWxhci1qd3Qvc3JjL2xpYi9hbmd1bGFyLWp3dC5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNMLFFBQVEsRUFFUixRQUFRLEVBQ1IsUUFBUSxHQUVULE1BQU0sZUFBZSxDQUFDO0FBQ3ZCLE9BQU8sRUFBZSxpQkFBaUIsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ3RFLE9BQU8sRUFBRSxjQUFjLEVBQU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ICAgICAgICBgSnd0TW9kdWxlIGlzIGFscmVhZHkgbG9hZGVkLiBJdCBzaG91bGQgb25seSBiZSBpbXBvcnRlZCBpbiB5b3VyIGFwcGxpY2F0aW9uJ3MgbWFpbiBtb2R1bGUuYFxuICAgICAgKTtcbiAgICB9XG4gIH1cbiAgc3RhdGljIGZvclJvb3Qob3B0aW9uczogSnd0TW9kdWxlT3B0aW9ucyk6IE1vZHVsZVdpdGhQcm92aWRlcnM8Snd0TW9kdWxlPiB7XG4gICAgcmV0dXJuIHtcbiAgICAgIG5nTW9kdWxlOiBKd3RNb2R1bGUsXG4gICAgICBwcm92aWRlcnM6IFtcbiAgICAgICAge1xuICAgICAgICAgIHByb3ZpZGU6IEhUVFBfSU5URVJDRVBUT1JTLFxuICAgICAgICAgIHVzZUNsYXNzOiBKd3RJbnRlcmNlcHRvcixcbiAgICAgICAgICBtdWx0aTogdHJ1ZSxcbiAgICAgICAgfSxcbiAgICAgICAgb3B0aW9ucy5qd3RPcHRpb25zUHJvdmlkZXIgfHwge1xuICAgICAgICAgIHByb3ZpZGU6IEpXVF9PUFRJT05TLFxuICAgICAgICAgIHVzZVZhbHVlOiBvcHRpb25zLmNvbmZpZyxcbiAgICAgICAgfSxcbiAgICAgICAgSnd0SGVscGVyU2VydmljZSxcbiAgICAgIF0sXG4gICAgfTtcbiAgfVxufVxuIl19

@@ -1,7 +0,8 @@

import { Injectable, Inject } from "@angular/core";
import { DOCUMENT } from "@angular/common";
import { JwtHelperService } from "./jwthelper.service";
import { JWT_OPTIONS } from "./jwtoptions.token";
import { mergeMap } from "rxjs/operators";
import { from } from "rxjs";
import { Injectable, Inject } from '@angular/core';
import { DOCUMENT } from '@angular/common';
import { JWT_OPTIONS } from './jwtoptions.token';
import { mergeMap } from 'rxjs/operators';
import { from } from 'rxjs';
import * as i0 from "@angular/core";
import * as i1 from "./jwthelper.service";
export class JwtInterceptor {

@@ -11,9 +12,9 @@ constructor(config, jwtHelper, document) {

this.document = document;
this.standardPorts = ["80", "443"];
this.standardPorts = ['80', '443'];
this.tokenGetter = config.tokenGetter;
this.headerName = config.headerName || "Authorization";
this.headerName = config.headerName || 'Authorization';
this.authScheme =
config.authScheme || config.authScheme === ""
config.authScheme || config.authScheme === ''
? config.authScheme
: "Bearer ";
: 'Bearer ';
this.allowedDomains = config.allowedDomains || [];

@@ -33,5 +34,5 @@ this.disallowedRoutes = config.disallowedRoutes || [];

const hostName = `${requestUrl.hostname}${requestUrl.port && !this.standardPorts.includes(requestUrl.port)
? ":" + requestUrl.port
: ""}`;
return (this.allowedDomains.findIndex((domain) => typeof domain === "string"
? ':' + requestUrl.port
: ''}`;
return (this.allowedDomains.findIndex((domain) => typeof domain === 'string'
? domain === hostName

@@ -45,3 +46,3 @@ : domain instanceof RegExp

return (this.disallowedRoutes.findIndex((route) => {
if (typeof route === "string") {
if (typeof route === 'string') {
const parsedRoute = new URL(route, this.document.location.origin);

@@ -61,3 +62,3 @@ return (parsedRoute.hostname === requestedUrl.hostname &&

if (!token && this.throwNoTokenError) {
throw new Error("Could not get token from tokenGetter function.");
throw new Error('Could not get token from tokenGetter function.');
}

@@ -94,10 +95,13 @@ if (this.skipWhenExpired) {

}
JwtInterceptor.decorators = [
{ type: Injectable }
];
JwtInterceptor.ctorParameters = () => [
{ type: undefined, decorators: [{ type: Inject, args: [JWT_OPTIONS,] }] },
{ type: JwtHelperService },
{ type: Document, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
];
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiand0LmludGVyY2VwdG9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvYW5ndWxhci1qd3Qvc3JjL2xpYi9qd3QuaW50ZXJjZXB0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLEVBQUUsTUFBTSxlQUFlLENB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gICAgICBbdGhpcy5oZWFkZXJOYW1lXTogYCR7YXV0aFNjaGVtZX0ke3Rva2VufWAsXG4gICAgICAgIH0sXG4gICAgICB9KTtcbiAgICB9XG4gICAgcmV0dXJuIG5leHQuaGFuZGxlKHJlcXVlc3QpO1xuICB9XG5cbiAgaW50ZXJjZXB0KFxuICAgIHJlcXVlc3Q6IEh0dHBSZXF1ZXN0PGFueT4sXG4gICAgbmV4dDogSHR0cEhhbmRsZXJcbiAgKTogT2JzZXJ2YWJsZTxIdHRwRXZlbnQ8YW55Pj4ge1xuICAgIGlmICghdGhpcy5pc0FsbG93ZWREb21haW4ocmVxdWVzdCkgfHwgdGhpcy5pc0Rpc2FsbG93ZWRSb3V0ZShyZXF1ZXN0KSkge1xuICAgICAgcmV0dXJuIG5leHQuaGFuZGxlKHJlcXVlc3QpO1xuICAgIH1cbiAgICBjb25zdCB0b2tlbiA9IHRoaXMudG9rZW5HZXR0ZXIocmVxdWVzdCk7XG5cbiAgICBpZiAodG9rZW4gaW5zdGFuY2VvZiBQcm9taXNlKSB7XG4gICAgICByZXR1cm4gZnJvbSh0b2tlbikucGlwZShcbiAgICAgICAgbWVyZ2VNYXAoKGFzeW5jVG9rZW46IHN0cmluZyB8IG51bGwpID0+IHtcbiAgICAgICAgICByZXR1cm4gdGhpcy5oYW5kbGVJbnRlcmNlcHRpb24oYXN5bmNUb2tlbiwgcmVxdWVzdCwgbmV4dCk7XG4gICAgICAgIH0pXG4gICAgICApO1xuICAgIH0gZWxzZSB7XG4gICAgICByZXR1cm4gdGhpcy5oYW5kbGVJbnRlcmNlcHRpb24odG9rZW4sIHJlcXVlc3QsIG5leHQpO1xuICAgIH1cbiAgfVxufVxuIl19
JwtInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: JwtInterceptor, deps: [{ token: JWT_OPTIONS }, { token: i1.JwtHelperService }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
JwtInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: JwtInterceptor });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: JwtInterceptor, decorators: [{
type: Injectable
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
type: Inject,
args: [JWT_OPTIONS]
}] }, { type: i1.JwtHelperService }, { type: Document, decorators: [{
type: Inject,
args: [DOCUMENT]
}] }]; } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiand0LmludGVyY2VwdG9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvYW5ndWxhci1qd3Qvc3JjL2xpYi9qd3QuaW50ZXJjZXB0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFPbkQsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBRTNDLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUVqRCxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFDMUMsT0FBTyxFQUFFLElBQUksRUFBYyxNQUFNLE1BQU0sQ0FBQzs7O0FBR3hDLE1BQU0sT0FBTyxjQUFjO0lBWXpCLFlBQ3VCLE1BQVcsRUFDekIsU0FBMkIsRUFDUixRQUFrQjtRQURyQyxjQUFTLEdBQVQsU0FBUyxDQUFrQjtRQUNSLGFBQVEsR0FBUixRQUFRLENBQVU7UUFMOUMsa0JBQWEsR0FBYSxDQUFDLElBQUksRUFBRSxLQUFLLENBQUMsQ0FBQztRQU90QyxJQUFJLENBQUMsV0FBVyxHQUFHLE1BQU0sQ0FBQyxXQUFXLENB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cmV0dXJuIGZyb20odG9rZW4pLnBpcGUoXG4gICAgICAgIG1lcmdlTWFwKChhc3luY1Rva2VuOiBzdHJpbmcgfCBudWxsKSA9PiB7XG4gICAgICAgICAgcmV0dXJuIHRoaXMuaGFuZGxlSW50ZXJjZXB0aW9uKGFzeW5jVG9rZW4sIHJlcXVlc3QsIG5leHQpO1xuICAgICAgICB9KVxuICAgICAgKTtcbiAgICB9IGVsc2Uge1xuICAgICAgcmV0dXJuIHRoaXMuaGFuZGxlSW50ZXJjZXB0aW9uKHRva2VuLCByZXF1ZXN0LCBuZXh0KTtcbiAgICB9XG4gIH1cbn1cbiJdfQ==
// tslint:disable:no-bitwise
import { Injectable, Inject } from "@angular/core";
import { JWT_OPTIONS } from "./jwtoptions.token";
import { Injectable, Inject } from '@angular/core';
import { JWT_OPTIONS } from './jwtoptions.token';
import * as i0 from "@angular/core";
export class JwtHelperService {

@@ -9,3 +10,3 @@ constructor(config = null) {

urlBase64Decode(str) {
let output = str.replace(/-/g, "+").replace(/_/g, "/");
let output = str.replace(/-/g, '+').replace(/_/g, '/');
switch (output.length % 4) {

@@ -16,11 +17,11 @@ case 0: {

case 2: {
output += "==";
output += '==';
break;
}
case 3: {
output += "=";
output += '=';
break;
}
default: {
throw new Error("Illegal base64url string!");
throw new Error('Illegal base64url string!');
}

@@ -32,7 +33,7 @@ }

b64decode(str) {
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
let output = "";
str = String(str).replace(/=+$/, "");
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
let output = '';
str = String(str).replace(/=+$/, '');
if (str.length % 4 === 1) {
throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");
throw new Error(`'atob' failed: The string to be decoded is not correctly encoded.`);
}

@@ -60,17 +61,17 @@ for (

.call(this.b64decode(str), (c) => {
return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
})
.join(""));
.join(''));
}
decodeToken(token = this.tokenGetter()) {
if (!token || token === "") {
if (!token || token === '') {
return null;
}
const parts = token.split(".");
const parts = token.split('.');
if (parts.length !== 3) {
throw new Error("The inspected token doesn't appear to be a JWT. Check to make sure it has three parts and see https://jwt.io for more.");
throw new Error(`The inspected token doesn't appear to be a JWT. Check to make sure it has three parts and see https://jwt.io for more.`);
}
const decoded = this.urlBase64Decode(parts[1]);
if (!decoded) {
throw new Error("Cannot decode the token.");
throw new Error('Cannot decode the token.');
}

@@ -82,3 +83,3 @@ return JSON.parse(decoded);

decoded = this.decodeToken(token);
if (!decoded || !decoded.hasOwnProperty("exp")) {
if (!decoded || !decoded.hasOwnProperty('exp')) {
return null;

@@ -91,3 +92,3 @@ }

isTokenExpired(token = this.tokenGetter(), offsetSeconds) {
if (!token || token === "") {
if (!token || token === '') {
return true;

@@ -103,3 +104,3 @@ }

getAuthScheme(authScheme, request) {
if (typeof authScheme === "function") {
if (typeof authScheme === 'function') {
return authScheme(request);

@@ -110,8 +111,10 @@ }

}
JwtHelperService.decorators = [
{ type: Injectable }
];
JwtHelperService.ctorParameters = () => [
{ type: undefined, decorators: [{ type: Inject, args: [JWT_OPTIONS,] }] }
];
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiand0aGVscGVyLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9hbmd1bGFyLWp3dC9zcmMvbGliL2p3dGhlbHBlci5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLDRCQUE0QjtBQUU1QixPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUNuRCxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QU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ldHRlcigpLFxuICAgIG9mZnNldFNlY29uZHM/OiBudW1iZXJcbiAgKTogYm9vbGVhbiB7XG4gICAgaWYgKCF0b2tlbiB8fCB0b2tlbiA9PT0gXCJcIikge1xuICAgICAgcmV0dXJuIHRydWU7XG4gICAgfVxuICAgIGNvbnN0IGRhdGUgPSB0aGlzLmdldFRva2VuRXhwaXJhdGlvbkRhdGUodG9rZW4pO1xuICAgIG9mZnNldFNlY29uZHMgPSBvZmZzZXRTZWNvbmRzIHx8IDA7XG5cbiAgICBpZiAoZGF0ZSA9PT0gbnVsbCkge1xuICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH1cblxuICAgIHJldHVybiAhKGRhdGUudmFsdWVPZigpID4gbmV3IERhdGUoKS52YWx1ZU9mKCkgKyBvZmZzZXRTZWNvbmRzICogMTAwMCk7XG4gIH1cblxuICBwdWJsaWMgZ2V0QXV0aFNjaGVtZShcbiAgICBhdXRoU2NoZW1lOiBGdW5jdGlvbiB8IHN0cmluZyB8IHVuZGVmaW5lZCxcbiAgICByZXF1ZXN0OiBIdHRwUmVxdWVzdDxhbnk+XG4gICk6IHN0cmluZyB7XG4gICAgaWYgKHR5cGVvZiBhdXRoU2NoZW1lID09PSBcImZ1bmN0aW9uXCIpIHtcbiAgICAgIHJldHVybiBhdXRoU2NoZW1lKHJlcXVlc3QpO1xuICAgIH1cblxuICAgIHJldHVybiBhdXRoU2NoZW1lO1xuICB9XG59XG4iXX0=
JwtHelperService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: JwtHelperService, deps: [{ token: JWT_OPTIONS }], target: i0.ɵɵFactoryTarget.Injectable });
JwtHelperService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: JwtHelperService });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: JwtHelperService, decorators: [{
type: Injectable
}], ctorParameters: function () { return [{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YgKHR5cGVvZiBhdXRoU2NoZW1lID09PSAnZnVuY3Rpb24nKSB7XG4gICAgICByZXR1cm4gYXV0aFNjaGVtZShyZXF1ZXN0KTtcbiAgICB9XG5cbiAgICByZXR1cm4gYXV0aFNjaGVtZTtcbiAgfVxufVxuIl19

@@ -0,1 +1,2 @@

import * as i0 from '@angular/core';
import { InjectionToken, Injectable, Inject, NgModule, Optional, SkipSelf } from '@angular/core';

@@ -15,3 +16,3 @@ import { DOCUMENT } from '@angular/common';

urlBase64Decode(str) {
let output = str.replace(/-/g, "+").replace(/_/g, "/");
let output = str.replace(/-/g, '+').replace(/_/g, '/');
switch (output.length % 4) {

@@ -22,11 +23,11 @@ case 0: {

case 2: {
output += "==";
output += '==';
break;
}
case 3: {
output += "=";
output += '=';
break;
}
default: {
throw new Error("Illegal base64url string!");
throw new Error('Illegal base64url string!');
}

@@ -38,7 +39,7 @@ }

b64decode(str) {
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
let output = "";
str = String(str).replace(/=+$/, "");
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
let output = '';
str = String(str).replace(/=+$/, '');
if (str.length % 4 === 1) {
throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");
throw new Error(`'atob' failed: The string to be decoded is not correctly encoded.`);
}

@@ -66,17 +67,17 @@ for (

.call(this.b64decode(str), (c) => {
return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
})
.join(""));
.join(''));
}
decodeToken(token = this.tokenGetter()) {
if (!token || token === "") {
if (!token || token === '') {
return null;
}
const parts = token.split(".");
const parts = token.split('.');
if (parts.length !== 3) {
throw new Error("The inspected token doesn't appear to be a JWT. Check to make sure it has three parts and see https://jwt.io for more.");
throw new Error(`The inspected token doesn't appear to be a JWT. Check to make sure it has three parts and see https://jwt.io for more.`);
}
const decoded = this.urlBase64Decode(parts[1]);
if (!decoded) {
throw new Error("Cannot decode the token.");
throw new Error('Cannot decode the token.');
}

@@ -88,3 +89,3 @@ return JSON.parse(decoded);

decoded = this.decodeToken(token);
if (!decoded || !decoded.hasOwnProperty("exp")) {
if (!decoded || !decoded.hasOwnProperty('exp')) {
return null;

@@ -97,3 +98,3 @@ }

isTokenExpired(token = this.tokenGetter(), offsetSeconds) {
if (!token || token === "") {
if (!token || token === '') {
return true;

@@ -109,3 +110,3 @@ }

getAuthScheme(authScheme, request) {
if (typeof authScheme === "function") {
if (typeof authScheme === 'function') {
return authScheme(request);

@@ -116,8 +117,10 @@ }

}
JwtHelperService.decorators = [
{ type: Injectable }
];
JwtHelperService.ctorParameters = () => [
{ type: undefined, decorators: [{ type: Inject, args: [JWT_OPTIONS,] }] }
];
JwtHelperService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: JwtHelperService, deps: [{ token: JWT_OPTIONS }], target: i0.ɵɵFactoryTarget.Injectable });
JwtHelperService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: JwtHelperService });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: JwtHelperService, decorators: [{
type: Injectable
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
type: Inject,
args: [JWT_OPTIONS]
}] }]; } });

@@ -128,9 +131,9 @@ class JwtInterceptor {

this.document = document;
this.standardPorts = ["80", "443"];
this.standardPorts = ['80', '443'];
this.tokenGetter = config.tokenGetter;
this.headerName = config.headerName || "Authorization";
this.headerName = config.headerName || 'Authorization';
this.authScheme =
config.authScheme || config.authScheme === ""
config.authScheme || config.authScheme === ''
? config.authScheme
: "Bearer ";
: 'Bearer ';
this.allowedDomains = config.allowedDomains || [];

@@ -150,5 +153,5 @@ this.disallowedRoutes = config.disallowedRoutes || [];

const hostName = `${requestUrl.hostname}${requestUrl.port && !this.standardPorts.includes(requestUrl.port)
? ":" + requestUrl.port
: ""}`;
return (this.allowedDomains.findIndex((domain) => typeof domain === "string"
? ':' + requestUrl.port
: ''}`;
return (this.allowedDomains.findIndex((domain) => typeof domain === 'string'
? domain === hostName

@@ -162,3 +165,3 @@ : domain instanceof RegExp

return (this.disallowedRoutes.findIndex((route) => {
if (typeof route === "string") {
if (typeof route === 'string') {
const parsedRoute = new URL(route, this.document.location.origin);

@@ -178,3 +181,3 @@ return (parsedRoute.hostname === requestedUrl.hostname &&

if (!token && this.throwNoTokenError) {
throw new Error("Could not get token from tokenGetter function.");
throw new Error('Could not get token from tokenGetter function.');
}

@@ -211,10 +214,13 @@ if (this.skipWhenExpired) {

}
JwtInterceptor.decorators = [
{ type: Injectable }
];
JwtInterceptor.ctorParameters = () => [
{ type: undefined, decorators: [{ type: Inject, args: [JWT_OPTIONS,] }] },
{ type: JwtHelperService },
{ type: Document, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
];
JwtInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: JwtInterceptor, deps: [{ token: JWT_OPTIONS }, { token: JwtHelperService }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
JwtInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: JwtInterceptor });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: JwtInterceptor, decorators: [{
type: Injectable
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
type: Inject,
args: [JWT_OPTIONS]
}] }, { type: JwtHelperService }, { type: Document, decorators: [{
type: Inject,
args: [DOCUMENT]
}] }]; } });

@@ -224,3 +230,3 @@ class JwtModule {

if (parentModule) {
throw new Error("JwtModule is already loaded. It should only be imported in your application's main module.");
throw new Error(`JwtModule is already loaded. It should only be imported in your application's main module.`);
}

@@ -246,8 +252,12 @@ }

}
JwtModule.decorators = [
{ type: NgModule }
];
JwtModule.ctorParameters = () => [
{ type: JwtModule, decorators: [{ type: Optional }, { type: SkipSelf }] }
];
JwtModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: JwtModule, deps: [{ token: JwtModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule });
JwtModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: JwtModule });
JwtModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: JwtModule });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: JwtModule, decorators: [{
type: NgModule
}], ctorParameters: function () { return [{ type: JwtModule, decorators: [{
type: Optional
}, {
type: SkipSelf
}] }]; } });

@@ -254,0 +264,0 @@ /*

@@ -1,3 +0,4 @@

import { ModuleWithProviders, Provider } from "@angular/core";
import { HttpRequest } from "@angular/common/http";
import { ModuleWithProviders, Provider } from '@angular/core';
import { HttpRequest } from '@angular/common/http';
import * as i0 from "@angular/core";
export interface JwtConfig {

@@ -19,2 +20,5 @@ tokenGetter?: (request?: HttpRequest<any>) => string | null | Promise<string | null>;

static forRoot(options: JwtModuleOptions): ModuleWithProviders<JwtModule>;
static ɵfac: i0.ɵɵFactoryDeclaration<JwtModule, [{ optional: true; skipSelf: true; }]>;
static ɵmod: i0.ɵɵNgModuleDeclaration<JwtModule, never, never, never>;
static ɵinj: i0.ɵɵInjectorDeclaration<JwtModule>;
}

@@ -1,4 +0,5 @@

import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from "@angular/common/http";
import { JwtHelperService } from "./jwthelper.service";
import { Observable } from "rxjs";
import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http';
import { JwtHelperService } from './jwthelper.service';
import { Observable } from 'rxjs';
import * as i0 from "@angular/core";
export declare class JwtInterceptor implements HttpInterceptor {

@@ -20,2 +21,4 @@ jwtHelper: JwtHelperService;

intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
static ɵfac: i0.ɵɵFactoryDeclaration<JwtInterceptor, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<JwtInterceptor>;
}

@@ -1,2 +0,3 @@

import { HttpRequest } from "@angular/common/http";
import { HttpRequest } from '@angular/common/http';
import * as i0 from "@angular/core";
export declare class JwtHelperService {

@@ -12,2 +13,4 @@ tokenGetter: () => string;

getAuthScheme(authScheme: Function | string | undefined, request: HttpRequest<any>): string;
static ɵfac: i0.ɵɵFactoryDeclaration<JwtHelperService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<JwtHelperService>;
}
{
"name": "@auth0/angular-jwt",
"version": "5.0.2",
"description": "JSON Web Token helper library for Angular",
"private": false,
"repository": {
"type": "git",
"url": "git+https://github.com/auth0/angular2-jwt"
},
"author": "Sam Bellen",
"license": "MIT",
"bugs": {
"url": "https://github.com/auth0/angular2-jwt/issues"
},
"keywords": [
"angular",
"angular 2",
"authentication",
"jwt"
],
"homepage": "https://github.com/auth0/angular2-jwt",
"peerDependencies": {
"@angular/common": ">=9.0.0"
},
"dependencies": {
"tslib": "^2.0.0"
},
"main": "bundles/auth0-angular-jwt.umd.js",
"module": "fesm2015/auth0-angular-jwt.js",
"es2015": "fesm2015/auth0-angular-jwt.js",
"esm2015": "esm2015/auth0-angular-jwt.js",
"fesm2015": "fesm2015/auth0-angular-jwt.js",
"typings": "auth0-angular-jwt.d.ts",
"metadata": "auth0-angular-jwt.metadata.json",
"sideEffects": false
"name": "@auth0/angular-jwt",
"version": "5.1.0",
"description": "JSON Web Token helper library for Angular",
"private": false,
"repository": {
"type": "git",
"url": "git+https://github.com/auth0/angular2-jwt"
},
"author": "Sam Bellen",
"license": "MIT",
"bugs": {
"url": "https://github.com/auth0/angular2-jwt/issues"
},
"keywords": [
"angular",
"angular 2",
"authentication",
"jwt"
],
"homepage": "https://github.com/auth0/angular2-jwt",
"peerDependencies": {
"@angular/common": ">=12.0.0"
},
"dependencies": {
"tslib": "^2.0.0"
},
"main": "bundles/auth0-angular-jwt.umd.js",
"module": "fesm2015/auth0-angular-jwt.js",
"es2015": "fesm2015/auth0-angular-jwt.js",
"esm2015": "esm2015/auth0-angular-jwt.js",
"fesm2015": "fesm2015/auth0-angular-jwt.js",
"typings": "auth0-angular-jwt.d.ts",
"sideEffects": false
}

@@ -5,14 +5,15 @@ # @auth0/angular-jwt

### **NOTE:** This library is now at version 5 and is published on npm as `@auth0/angular-jwt`. If you're looking for the pre-v1.0 version of this library, it can be found in the `pre-v1.0` branch and on npm as `angular2-jwt`.
This library provides an `HttpInterceptor` which automatically attaches a [JSON Web Token](https://jwt.io) to `HttpClient` requests.
**Version v5 of this library has some breaking changes concerning the `allowedDomains` and `disallowedRoutes`.**
This library does not have any functionality for (or opinion about) implementing user authentication and retrieving JWTs to begin with. Those details will vary depending on your setup, but in most cases, you will use a regular HTTP request to authenticate your users and then save their JWTs in local storage or in a cookie if successful.
**@auth0/angular-jwt v5 is to be used with Angular v10+ and RxJS v6+. For Angular v6+ to v9, use @auth0/angular-jwt v4**
## Supported Angular versions
This project only supports the [actively supported versions of Angular as stated in the Angular documentation](https://angular.io/guide/releases#actively-supported-versions). Whilst other versions might be compatible they are not actively supported
This library provides an `HttpInterceptor` which automatically attaches a [JSON Web Token](https://jwt.io) to `HttpClient` requests.
## Sponsor
This library does not have any functionality for (or opinion about) implementing user authentication and retrieving JWTs to begin with. Those details will vary depending on your setup, but in most cases, you will use a regular HTTP request to authenticate your users and then save their JWTs in local storage or in a cookie if successful.
|||
|-|-|
|![auth0 logo](https://user-images.githubusercontent.com/83319/31722733-de95bbde-b3ea-11e7-96bf-4f4e8f915588.png)|If you want to quickly add secure token-based authentication to your Angular projects, feel free to check [Auth0's Angular SDK](https://github.com/auth0/auth0-angular) and free plan at [auth0.com/developers](https://auth0.com/developers?utm_source=GHsponsor&utm_medium=GHsponsor&utm_campaign=angular2-jwt&utm_content=auth)|
> **Note:** This library can only be used with Angular 4.3 and higher because it relies on an `HttpInterceptor` from Angular's `HttpClient`. This feature is not available on lower versions.
## Installation

@@ -19,0 +20,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc