-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting 'User-Agent' header causes error in browser. #10
Comments
Thanks for the bug report! I'll see about making this conditional, and if not, removing it altogether. |
Thx bryce. |
I'm getting this as well in Chromium with particle.login():
Going to try removing the line that add the User Agent and give it a try. |
I just released |
Hello @brycekahle I might be out of line here, i just downloaded version "particle-api-js": "^5.2.6"
made an easy login request
And i get error in chrome console log
I have been asking on the forum about it but yet not received any answer but other people have reached out to me saying they have this issue as well and it was caused from an update but they cant say which one. BR |
@brycekahle /Dimi |
@Dimicus I think your bug is valid. I see that |
On further examination, it only sets that if |
@brycekahle Where Can i see IF the package i downloaded with npm install particle-api-Js contains this issue? Please note that other people have claimed the same i.e https://community.particle.io/t/particle-api-js-user-agent-and-cache-control-errors/20664 And some others. Br |
@Dimicus the errors in that thread are different and were fixed by the code that solved this issue. What you are experiencing is something different and I have a suspicion that it is meteor related. |
I guess you are right. Bryce. thank you very much and have a great day. /Dimi |
If you can provide a small example meteor application that demonstrates the error, I can help dig in. |
Im pretty sure its meteor now. If you want to test you can use the login example below and use it on main.js in client folder on your meteor project ( meteor 1.3 )
Think due to 1.3 that you also need to do meteor install npm, happens alot there now so hard to follow :) But from my point of view this is all meteor issues, or rather that you need to use credential code in the server and not client, is security :) So its more a feature that you can use it on client side. BR |
Particle.request() and downloadFirmwareBinary() explicitly set the 'User-Agent' string. This isn't allowed in the web browser (see http://stackoverflow.com/questions/7210507/ajax-post-error-refused-to-set-unsafe-header-connection). The API calls works fine if this code is removed.
The text was updated successfully, but these errors were encountered: