Added the script reference to angular-cli.json:
"scripts":[
...
"../node_modules/angular2-jwt/angular2-jwt.js"
...
]
Ran "ng serve" No problems so far
caught ReferenceError: require is not defined at scripts.bundle.js:224 (anonymous) @ scripts.bundle.js:224
I don't want to keep implementing angular2-JWT with this error around. How can I fix this?
I couldn't find an answer, and actually there's an issue open at Github about this, unresolved.
So i found this manual implementation of JWT authentication for the client
The idea is just to retrieve the token from the server, store it in the local storage, and then send it as a header in each request.