Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Blank Response when using Authorization

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!!!! 🙂 

Best Answer
0 Votes
0 REPLIES 0