12-02-2014 08:05
12-02-2014 08:05
Hi,
We've been getting intermittent failures on fitbitClient.getResourceCredentialsByUser(...) API call for the same user when we have two identical server instances running. The call could work for a few times and then fail, suddenly.
The same API call works all the time when we've a single server instance. Has anyone experienced the same issue?
// Code snippet
LocalUserDetail localUser = new LocalUserDetail(...);
FitbitAPIClientService<FitbitApiClientAgentSSL> fitbitClient = getFitbitAPIClientService();
APIResourceCredentials resourceCredentials = fitbitClient.getResourceCredentialsByUser(localUser);
if (resourceCredentials == null) {
throw new RuntimeException("Unrecognized temporary token when attempting to complete
authorization: " + tempTokenReceived);
}
// Exception
SEVERE: Servlet.service() for servlet [mvc-dispatcher] in context with path [] threw exception [Request processing failed; nested exception is java.lang.RuntimeException: Unrecognized temporary token when attempting to complete authorization: 3b5c7f7d28efcdceccc317d61acb4cc0] with root cause
java.lang.RuntimeException: Unrecognized temporary token when attempting to complete authorization: 3b5c7f7d28efcdceccc317d61acb4cc0
Thanks,
kenny
12-02-2014 09:41
12-02-2014 09:41
The temporary token can only be used once. Once being used it can not be re-used gain to get permanent access key.
Since you're saying you started using two servers I'm pretty sure somehow you're trying to get permanent access token twice? In this case error response you're getting makes sence.
03-02-2015 21:17 - edited 03-02-2015 21:20
03-02-2015 21:17 - edited 03-02-2015 21:20
I have tomcats in a load balanced manner and I am getting this issue when I make http request from server without maintaining any session on tomcat server. How can this be solved ?
I can't also serialize and save in db the FitbitApiCredentialsCache object as its not serializable.
Why has Fitbit not provided an API which can work with load balacing environment instead of relying on single tomcat instance ?