Comments (18)
What error are you getting when doing get
requests? Does the same error happen with other request types? I haven't seen any issues with beta 1. I'll have the Auth0 samples updated pretty soon.
Thanks!
from angular2-jwt.
Error: EXCEPTION: Error during evaluation of "click" ORIGINAL EXCEPTION: TypeError: First argument must be a url string or Request instance. ORIGINAL STACKTRACE: makeTypeError@http://127.0.0.1:3000/vendor.bundle.js:3338:13 Http</Http.prototype.request@http://127.0.0.1:3000/vendor.bundle.js:34297:1 AuthHttp</AuthHttp.prototype._request@http://127.0.0.1:3000/vendor.bundle.js:35666:24 AuthHttp</AuthHttp.prototype.requestHelper@http://127.0.0.1:3000/vendor.bundle.js:35678:17 AuthHttp</AuthHttp.prototype.get@http://127.0.0.1:3000/vendor.bundle.js:35682:17 [372]/App</App.prototype.getThing@http://127.0.0.1:3000/main.bundle.js:72:10 anonymous/ChangeDetector_App_3.prototype.handleEventInternal@viewFactory_App:361:23 AbstractChangeDetector</AbstractChangeDetector.prototype.handleEvent@http://127.0.0.1:3000/vendor.bundle.js:10910:25
As I said, when I look at the request instance in the browser it looks fine to my eyes. (Login worked fine with auth0)
This is how I start the request :
this.authHttp.get(URL) .subscribe( data => console.log(data), err => console.log(err), () => console.log('Complete') );
Thanks for your fast response. Will continue to look into it tomorrow.
from angular2-jwt.
If I replace the else if instance of
with true
the request works just fine. So the problem is that my request is not an instance of static_request_1.Request.
Http.prototype.request = function (url, options) {
var responseObservable;
if (lang_1.isString(url)) {
responseObservable = httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethod.Get, url)));
}
else if (url instanceof static_request_1.Request) {
responseObservable = httpRequest(this._backend, url);
}
else {
throw exceptions_1.makeTypeError('First argument must be a url string or Request instance.');
}
return responseObservable;
};
Update:
Just also rebuild angular2-jwt with the last beta.1. Still same error, I start to think that it's just something with my project somewhere.
As a workaround I use a normal http.get and add the header with token myself.
from angular2-jwt.
I'm having the same issue when I pass in a string url to this.authHttp.get()
.
I don't think it's a problem with our apps (mine is nearly empty as i'm just starting this project), but rather a possible breaking change from https://github.com/angular/angular/blob/master/CHANGELOG.md#200-alpha48-2015-12-05.
from angular2-jwt.
@feliksg it is unlikely to be an issue with a breaking change from alpha48, as the library was updated specifically to deal with the breaking changes in the later alphas. Can you supply some sample code or a plunker that demonstrates the issue?
@tobika can you also provide sample code?
from angular2-jwt.
@escardin Sure, I created a plunkr with the code that i'm getting the error for, but not sure how to get the angular2-jwt dependency in plunkr.
https://plnkr.co/edit/d3ikfiiVDErzpKhBdx9p
from angular2-jwt.
Question for everyone seeing this error: what is your build setup? Are you working from a seed project?
I think this issue is being caused by some other dependencies and isn't specific to angular2-jwt
. I'm currently working on updating the Auth0 samples that use angular2-jwt
and I just now saw this error in an older version of the Webpack sample when using beta.1. The Webpack sample is based on angular2-webpack-starter. However, the SystemJS version which is based on ng2-play has no issues.
I'll comb through the deps in the Webpack version to try to find what it is.
from angular2-jwt.
I'm working from the angular2-webpack-starter (https://github.com/AngularClass/angular2-webpack-starter).
Thanks for responding so quickly and working with us to figure out the issue -- really appreciate it!
from angular2-jwt.
Same here, the angular-webpack-starter. Thanks a lot.
from angular2-jwt.
Here's a working plunk with get demonstrated. https://plnkr.co/edit/TPFeBZ45fwIWwvgPYrmn?p=preview
I based it on what @feliksg provided.
from angular2-jwt.
It looks like the issue for Webpack users might be the mixing of beta.0 and beta.1. @feliksg and @tobika can you please delete angular2-jwt
from your node modules and try installing it by itself again with npm install angular2-jwt
? Let me know if you still get the error after that. Thanks!
from angular2-jwt.
A quick note: the current version on npm still has beta.0 as the dep, but I want to see what happens with a clean install of where it's at first.
from angular2-jwt.
@chenkie I can confirm that i'm still having the issue after removing and installing it by itself. When installing it, it does list beta.0 as a dependency.
from angular2-jwt.
from angular2-jwt.
Ok thanks. Can you try doing npm run clean
? Depending on which version of the Webpack starter you're on, this might look different in the scripts in your package.json
.
Also, can you check if there's a node_modules
folder within the angular2-jwt
directory? If so, can you let me know what happens if you delete that?
from angular2-jwt.
@chenkie That worked! I ran npm run clean
then npm install
and then removed the node_modules
folder from the angular2-jwt
directory.
Thank you so much for all of your help!
from angular2-jwt.
Thanks also from my side, followed your tips and it works now :)
from angular2-jwt.
Awesome good to hear :) I'm going to leave this issue open for now in case it pops up again before the next release.
from angular2-jwt.
Related Issues (20)
- Error: The inspected token doesn't appear to be a JWT. Check to make sure it has three parts and see https://jwt.io for more. HOT 1
- Angular 12 support HttpInterceptor Context HOT 4
- Angular 13 support HOT 28
- upstream dependency conflict while installing angular2-jwt package using angular-cli HOT 1
- ``
- v5.1.0 broke azure devops publishing HOT 5
- Please respect semver HOT 3
- tokenGetter does not support Promise HOT 2
- Getting an issue of no exported member from angular core HOT 1
- Encourage the library authors to publish an Ivy distribution HOT 2
- Release v5.1.1 decodeToken<T = any>(token?: string): T | Promise<T> HOT 4
- 'ɵɵngDeclareFactory' (imported as 'i0') was not found in '@angular/core' HOT 2
- Authorization header stops going through after the browser sits idle for a while. HOT 7
- JwtInterceptor not work HOT 2
- No header with standalone components HOT 4
- Angular 16 support HOT 1
- Package not working with es2022 HOT 4
- Angular JWT 5.0.2 not compiling with Angular 13.3.6 HOT 1
- App no longer working after installing auth0 HOT 1
- angular2-jwt is way outdated.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular2-jwt.