06-09-2016 06:02 - edited 06-09-2016 10:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

06-09-2016 06:02 - edited 06-09-2016 10:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
If I do a javascript xmlhttprequest with the Authorization: etc information attached I get a blank response. It is as if the request is not being picked up.
However, if I remove the Authorization information and just send...
https://api.fitbit.com/1/user/-/activities/list.json
I get an error back about how an Authorization Header is required.
If I just Add the word Authorization and a colon I get a blank responze back
https://api.fitbit.com/1/user/-/activities/list.json Authorization:
Any suggestions would be appreciated.
----------------- EDIT -------------------
I did not realize that an Authrization Header was a separate part of the xmlhttprequest
I have solved this by using the setRequestHeader method (the .... are replaced with token).
var myxmlHttpRequest = xmlRequest = new XMLHttpRequest();
myxmlHttpRequest.open("GET","https://api.fitbit.com/1/user/-/activities/steps/date/today/1m.json",false);
myxmlHttpRequest.setRequestHeader("Authorization", "Bearer .............");
myxmlHttpRequest.open();
This returns some data from FitBit API!!!! 🙂

- Labels:
-
JavaScript
-
OAuth 2.0
