09-19-2015 21:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

09-19-2015 21:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
HI,
1. I am able to authroize and also got access token .But when i try to fetch the profile and activity data , i am getting response 09-20 09:42:16.701: E/JSONStr(32702): {"errors":[{"errorType":"oauth","fieldName":"n/a","message":"No Authorization header provided in the request. Each call to Fitbit API should be OAuth signed"}],"success":false}n
Although i already used same authorization header while accessing the access token.Please help me to get it resolved.
httpClient = new DefaultHttpClient();
httpGet = new HttpGet(
"https://api.fitbit.com/1/user/-/profile.json");
httpGet.setHeader("Content-Type", "application/x-www-form-urlencoded");
httpGet.setHeader("Authorization: ",
"Bearer" + acessToken);
httpGet.setHeader("Accept-Language", "en_US");
httpGet.setHeader("Accept-Locales", "en_US");
2. I am not able to set multiple scope .once i put multiple scope ,i am not getting code in the callback url.
09-20-2015 00:07
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

SunsetRunner
09-20-2015 00:07
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

09-20-2015 02:12
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

09-20-2015 02:12
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
HI,
Now i am getting different error like
html><body><h1>400 Bad request</h1>Your browser sent an invalid request.</body></html>
Please the below code and let me know what i am missing. Please help me .
String uri = "https://api.fitbit.com/1/user/-/profile.json";
// HttpParams httpParams = new BasicHttpParams();
DefaultHttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(uri);
request.setHeader("Authorization ",
"Bearer" + accesstoken);
request.setHeader("Accept-Language", "en_US");
request.setHeader("Accept-Locales", "en_US");
HttpResponse response = null;
try {
response = client.execute(request);
} catch (ClientProtocolException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
String responseStr = null;
try {
responseStr = buildResponseFromEntity(response.getEntity());
} catch (IllegalStateException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Thanks
Rockey

09-20-2015 08:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

SunsetRunner
09-20-2015 08:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

09-20-2015 19:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

09-20-2015 19:52
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi,
if i removed the extra space then i am getting {"errors":[{"errorType":"oauth","fieldName":"n/a","message":"Incorrect authorization method."}],"success":false}
DefaultHttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(uri);
request.setHeader("Authorization","Bearer" + tok);
request.setHeader("Accept-Language", "en_US");
request.setHeader("Accept-Locales", "en_US");
HttpResponse response = null;
try {
response = client.execute(request);
} catch (ClientProtocolException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
String responseStr = null;
try {
responseStr = buildResponseFromEntity(response.getEntity());
} catch (IllegalStateException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Please help me to get it solved.
Thanks
Rockey

09-20-2015 20:17
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

SunsetRunner
09-20-2015 20:17
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

03-11-2016 17:13
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

03-11-2016 17:13
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi,
Thank you for the above response......
i am just using my app after few months and i am getting some error while fetching the profile data after getting access token,
03-12 12:09:10.775: E/JSONStr(16633): {"access_token":"eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0NTc3NDg2MTIsInNjb3BlcyI6IndociIsInN1YiI6IjNRQk1IQiIsImF1ZCI6IjIyN043QyIsImlzcyI6IkZpdGJpdCIsInR5cCI6ImFjY2Vzc190b2tlbiIsImlhdCI6MTQ1Nzc0NTAxMn0.1jWb0rlvIW6B_E1kglQnklEg3wr3g5q-a0fSdR134_M","expires_in":3600,"refresh_token":"4c76dc06513f06ebc700f8f10adce8d7f83271c5a9a37444f526642a378cd3b8","scope":"heartrate","token_type":"Bearer","user_id":"3QBMHB"}n
03-12 12:09:12.150: E/JSONStr(16633): {"error":"invalid_grant","error_description":"authentication failure"}n
03-12 12:09:12.150: D/Token Access(16633): eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0NTc3NDg2MTIsInNjb3BlcyI6IndociIsInN1YiI6IjNRQk1IQiIsImF1ZCI6IjIyN043QyIsImlzcyI6IkZpdGJpdCIsInR5cCI6ImFjY2Vzc190b2tlbiIsImlhdCI6MTQ1Nzc0NTAxMn0.1jWb0rlvIW6B_E1kglQnklEg3wr3g5q-a0fSdR134_M
03-12 12:09:12.150: D/Expire(16633): 3600
03-12 12:09:12.150: D/Refresh(16633): 4c76dc06513f06ebc700f8f10adce8d7f83271c5a9a37444f526642a378cd3b8
DefaultHttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(Url);
request.setHeader("Authorization","Bearer "+token);
request.setHeader("Accept-Language", "en_US");
request.setHeader("Accept-Locales", "en_US");
//request.setHeader("Accept", "application/json");
HttpResponse response = null;
try {
response = client.execute(request);
} catch (ClientProtocolException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
String responseStr = null;
try {
responseStr = buildResponseFromEntity(response.getEntity());
} catch (IllegalStateException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
JSONObject jsonObj = null;
// check if error
if (response.getStatusLine().getStatusCode() == 200) {
try {
jsonObj = new JSONObject(responseStr);
} catch (Exception e) {
e.printStackTrace();
}
}
// Return JSON String
return jsonObj;
Please help me to resolve this issue

