Closed ghost closed 6 years ago
the issue is rxjs 6.0. It looks like only three changes need to be made:
In jwt.interceptor.d.ts, and in jtw.interceptor.js, change
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromPromise';
import 'rxjs/add/operator/mergeMap';
to
import { Observable, pipe } from 'rxjs';
import { fromPromise, mergeMap } from 'rxjs/operators';
then in the js file, change
return Observable.fromPromise(token).mergeMap(function (asyncToken) {
return _this.handleInterception(asyncToken, request, next);
});
to
return Observable.pipe(fromPromise(token),mergeMap(function (asyncToken) {
return _this.handleInterception(asyncToken, request, next);
}));
Note that gets it to compile, but I've done no testing on it.
I get the following error: Package "@auth0/angular-jwt" has an incompatible peer dependency to "@angular/common" (requires "^4.4.6||^5.0.0", would install "6.0.0")
after adding everything and trying alot get the followng error in browser console ReferenceError: angular is not defined at angular-jwt.js:9 at Object../node_modules/angular-
would you please fix the issue for angular 6
This lib is actually for Angular 1. You're looking for http://github.com/auth0/angular2-jwt
The naming of the packages can make you confused actually.
According to here (https://www.npmjs.com/package/@auth0/angular-jwt), you should be using @auth0/angular-jwt
that supports Angular6+.
Please try with npm install @auth0/angular-jwt
instead. I tested this earlier following the upgrade plan here (https://update.angular.io/) with the Angular2+ QuickStart SDK on Auth0 worked just fine.
thanks alot.
Is it in the master? should I update?
It works but the package rxjs-compat
is still required for backwards compatibility. Any idea when rxjs-compat
can be removed?
ERROR in node_modules/@auth0/angular-jwt/src/jwt.interceptor.d.ts(3,10): error TS2305: Module '"/home/user/project/node_modules/rxjs/Observable"' has no exported member 'Observable'. node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'.
Oho - I just saw the chenkie comment, I think he is right, SO I am closing this issue. Thanks chenkie.
ERROR TypeError: Observable_1.Observable.defer is not a function at AuthHttp.push../node_modules/angular2-jwt/angular2-jwt.js.AuthHttp.request (angular2-jwt.js:140) at AuthHttp.push../node_modules/angular2-jwt/angular2-jwt.js.AuthHttp.requestHelper (angular2-jwt.js:104) at AuthHttp.push../node_modules/angular2-jwt/angular2-jwt.js.AuthHttp.get (angular2-jwt.js:151)
getting this error after updating to angular 6
you are using angular2-jwt. change it to @auth0/angular-jwt.
@hesampour thanks bro it worked after moving to @auth0/angular-jwt v2
Packages Json:
Log Error:
ERROR in node_modules/@auth0/angular-jwt/src/jwt.interceptor.d.ts(3,10): error TS2305: Module '"C:/project/lawassito/node_modules/rxjs/Observable"' has no exported member 'Observable'. node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'.