06-19-2018 14:28
06-19-2018 14:28
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);
Best Answer06-29-2018 15:57
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
06-29-2018 15:57
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
Best Answer