09-15-2015 15:44
09-15-2015 15:44
Hi,
I was trying to get access token by following the API documentation. Still I am getting 401 Error. can you Please help me out on this ?
Here is my code :
var theUrl="https://api.fitbit.com/oauth2/token";
var params = "client_id=****&grant_type=authorization_code&redirect_uri=********";
xmlHttp.open( "post", theUrl, true);
var clientID = btoa("*****:**************");
console.log("clientID :: "+clientID);
var temp = atob(clientID);
console.log("temp :: "+temp);
xmlHttp.setRequestHeader("Authorization", "Basic "+clientID);
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlHttp.send( params );
Thanks in advance
09-15-2015 16:56
09-15-2015 16:56
Please provide an HTTP capture of the request and response. It's difficult for us to debug code for languages and libraries we're unfamiliar with. You might try using Runscope to do this.