Repository: auth0/angular2-jwt

Issue #250: Trouble using JwtHelper
Created: 2016-12-19T10:57:09Z
Hi,
I am fairly new to angular2 + typescript, so I am sorry if this is just an error on my part, but I don't think it is, hence why I am logging an issue, so to start with, I have a very basic application at the moment, to which I am trying to integrate angular2-jwt with, so in my systemjs.config.js I have the following setup
(function (global) {
    System.config({
        paths: {
            // paths serve as alias
            'npm:': 'node_modules/'
        },
        // map tells the System loader where to look for things
        map: {
            // our app is within the app folder
            app: 'app',

            // angular bundles
            '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
            '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
            '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
            '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
            '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
            '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
            '@angular/http/testing': 'npm:@angular/http/bundles/http-testing.umd.js',
            '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
            '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',

            // other libraries
            'rxjs': 'npm:rxjs',
            'angular2-jwt': 'npm:angular2-jwt'
        },
        // packages tells the System loader how to load when no filename and/or no extension
        packages: {
            app: {
                main: './main.js',
                defaultExtension: 'js'
            },
            rxjs: {
                defaultExtension: 'js'
            },
            "angular2-jwt": {
                "defaultExtension": "js"
            },
        }

    });
})(this);

Now If I start my app like this, I get no issues at all, however inside one of my typescript files (namely my auth_gaurd file, I have this code:
import { Injectable } from '@angular/core';
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { JwtHelper} from 'angular2-jwt';

I can import the JwtHelper fine without causing any errors, but when I add this line into my auth_guard file
jwtHelper: JwtHelper = new JwtHelper();
I get the following error in my npm start (terminal log)
[1] 16.12.19 10:22:54 404 GET /node_modules/angular2-jwt/
And then in my browsers console log:
zone.js:1382 GET http://localhost:3000/node_modules/angular2-jwt/ 404 (Not Found) (index):23 Error: (SystemJS) XHR error (404 Not Found) loading http://localhost:3000/node_modules/angular2-jwt(…)
But if I navigate to:
http://localhost:3000/node_modules/angular2-jwt/README.md
The readme file loads, so I know that the server is loading the correct files, what else can I do to debug this further?

Duplicate issue #251: Trouble with JwtHelper integration
Created: 2016-12-19T12:12:02Z
Hi,
I am fairly new to angular2 + typescript, so I am sorry if this is just an error on my part, but I don't think it is, hence why I am logging an issue, so to start with, I have a very basic application at the moment, to which I am trying to integrate angular2-jwt with, so in my systemjs.config.js I have the following setup
(function (global) {
    System.config({
        paths: {
            // paths serve as alias
            'npm:': 'node_modules/'
        },
        // map tells the System loader where to look for things
        map: {
            // our app is within the app folder
            app: 'app',

            // angular bundles
            '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
            '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
            '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
            '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
            '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
            '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
            '@angular/http/testing': 'npm:@angular/http/bundles/http-testing.umd.js',
            '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
            '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',

            // other libraries
            'rxjs': 'npm:rxjs',
            'angular2-jwt': 'npm:angular2-jwt'
        },
        // packages tells the System loader how to load when no filename and/or no extension
        packages: {
            app: {
                main: './main.js',
                defaultExtension: 'js'
            },
            rxjs: {
                defaultExtension: 'js'
            },
            "angular2-jwt": {
                "defaultExtension": "js"
            },
        }

    });
})(this);

Now If I start my app like this, I get no issues at all, however inside one of my typescript files (namely my auth_gaurd file, I have this code:
import { Injectable } from '@angular/core';
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { JwtHelper} from 'angular2-jwt';

I can import the JwtHelper fine without causing any errors, but when I add this line into my auth_guard file
jwtHelper: JwtHelper = new JwtHelper();
I get the following error in my npm start (terminal log)
[1] 16.12.19 10:22:54 404 GET /node_modules/angular2-jwt/
And then in my browsers console log:
zone.js:1382 GET http://localhost:3000/node_modules/angular2-jwt/ 404 (Not Found) (index):23 Error: (SystemJS) XHR error (404 Not Found) loading http://localhost:3000/node_modules/angular2-jwt(…)
But if I navigate to:
http://localhost:3000/node_modules/angular2-jwt/README.md
The readme file loads, so I know that the server is loading the correct files, what else can I do to debug this further?

Closing comment (2016-12-19T12:24:03Z): Duplicate of #250