0

I'm despairing..

installed npm package: "angular2-jwt": "^0.1.28" on my ionic2 project. (I'm using IntelliJ)

When I run "ionic serve" I get:

Runtime Error
Error in ./MyApp class MyApp - caused by: token.split is not a function

TypeError: token.split is not a function
    at JwtHelper.decodeToken (angular2-jwt.js:221)

I see in angular2-jws.js:

var parts = token.split('.');

split has multiple declarations (EcmaScript.js and EcmaScript6.js).

I also tried to change the JavaScript language version under Settings > Languages & Frameworks > JavaScript and serve again but without success.

The same code works on an Angular2 project using Visual Studio Code.

Would be super cool if somebody could give me a hint..

tobtherush
  • 87
  • 2
  • 7
  • split is a method of type string. Try to do typeof token === 'string' and see the output is false or true – misha130 Jan 22 '17 at 18:35
  • I lost a whole week dealing with this issue. My issue was that tokenGetter never received token from storage. Do you receive token? At the moment I hardcoded token and it works fine so I can continue app development and plan is to save it in native storage or SQLite. – ACES Jan 23 '17 at 07:09

0 Answers0