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

How to access the activities of multiple users from one application.

Dear Fitbit team.

 

I am implementing php based web application with oauth2. In my web application environment I may have hundreds of user which authorized my application using oauth2. Now I success to updated all users profile datas periodically without user invervation. But I received 403 error when I try to get 'Activity' resource. Only logged-in user's activity was returned properly but other users activity request retruns 403.

 

JSON returns

 

{"errors":[{"errorType":"insufficient_permissions","message":"API client is not authorized by the resource owner to access the resource requested. Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process."}],"success":false}

 

Is it possible to get all users activities with user intervation?

If it is possible what do I have to do? or what am I missing?

 

Please help me 

Thanks.

Best Answer
0 Votes
2 REPLIES 2

It sounds like you might not be using the correct user's credentials to fetch their data. (The access token used on that request does not belong to the user whose data you tried to fetch.)

Best Answer
0 Votes

@JeremiahFitbit wrote:

It sounds like you might not be using the correct user's credentials to fetch their data. (The access token used on that request does not belong to the user whose data you tried to fetch.)


I'd say that this is the exact problem.

 

The access token only lasts an hour. When you do a retrieve you should refresh the users access token to avoid any permission issues. Make sure that when you're fetching data for each user, you're using the specific users credentials, not a generic set of access/refresh codes. Each access/refresh code is unique to that user only and there only ever exists a 1:1 relationship between fitbit application (what you made) and the user account (the access code).

Best Answer
0 Votes