06-19-2018 14:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-19-2018 14:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I want to send a http request, but it returns "Unhandled ReferenceError: XMLHttpRequest is not defined".
this is my code:
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "requestUrl");
xhr.setRequestHeader("authorization", "Bearer {your_access_token}");
xhr.send(data);
console.log(this.responseText);

06-29-2018 15:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


06-29-2018 15:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
The device itself doesn't have an Internet connection. You need to use fetch() within the companion app.
Something like this example app https://github.com/Fitbit/sdk-oauth

