Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to retrieve several users' activity data #236

Open
tiffany3333 opened this issue Nov 23, 2017 · 1 comment
Open

Unable to retrieve several users' activity data #236

tiffany3333 opened this issue Nov 23, 2017 · 1 comment

Comments

@tiffany3333
Copy link

First off, great library! I've successfully used it to allow many individual users sign into my website, authorize my site to view their profile, activity, and location info, and view their individual step activity on my website! In the background, I'm storing their FitBitAuthToken securely in my database.

Now I would like the admin user of my site to be able to generate a report of all of my site users and their step activity. I have been unable to achieve this. Below is my code.

/The admin user logs into my site, gets redirected to fitbit login to authorize, and views his individual step data just like an individual user first, this is successful/

/The admin user then tries to generate a report of all users step data/

foreach (Enrollment person in enrollments)
{
FitbitAppCredentials appCredentials = (FitbitAppCredentials)Session["AppCredentials"];

var authenticator = new OAuth2Helper(appCredentials, Request.Url.GetLeftPart(UriPartial.Authority) + "/Fitbit/Callback");

Session["FitbitClient"] = null;             
client = new FitbitClient(appCredentials, person.FitBitAuthToken);

try
{
    response = await client.GetTimeSeriesIntAsync(TimeSeriesResourceType.Steps, startD, endD, person.FitBitAuthToken.UserId);                
}

In the report, the only successful response I get is for the admin user.

Also, I believe, if I have an unexpired token in my database for a user I can successfully get their step data in the report as well.

But all other users have an exception on the response (either 'Request exception' or 'Token exception').

So, I believe I've root caused the issue to needing a refreshed token for all user the generate that exception, but I've tried several different ways of obtaining it with no success.

@aarondcoleman
Copy link
Owner

aarondcoleman commented Nov 23, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants