0

I'm using the ionic framework in version 3. At time of writing, ionic 4 is still in beta. To my understanding, ionic 3 is only compatible up to angular 5.

I'm trying to add angular-token, which currently is at 6.0.4. A version 5 of angular-token apparently does not exist.

When installing angular-token@6 together with angular@5 and ionic@3, I'm getting some strange errors like:

// angular-token.js:700
TypeError: Object is not a function.
(In 'Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__
["defineInjectable"])', 'Object' is an instance of Object)

From similar issues I suspect that angular-token might be incompatible to angular@5 and thus to ionic@3. Is this correct?

Could you recommend something to implement token-based authentication against devise-token-auth with ionic 3?

fiedl
  • 5,667
  • 4
  • 44
  • 57

1 Answers1

0

I'm not sure whether this is a good idea, yet, but I got it to work by gently updating some of the packages:

npm install angular-token --save
npm i @angular/common@6.0 @angular/core@6.0 -s
npm i rxjs@6.0 -s
npm i @angular/forms@6.0
npm i @angular/animations@6.0 @angular/platform-browser@6.0 @angular/http@6.0
npm i rxjs-compat@6.0 -s
npm i @angular/router@6.0 -s

From this, I would think that angular-token is not compatible to angular 5, but works with ionic 3 when updating some packages to angular 6. But, I've tested only ionic lab, no native environments, yet.

fiedl
  • 5,667
  • 4
  • 44
  • 57