openmhealth / shimmer

An application for reading health data from third-party APIs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UserRedirectRequiredException occurred when retrieved data from shimmer after a week for same user.

waqaslatif88 opened this issue · comments

Hi, I have an application which uses shimmer server for device data retrieval and user authentication , First time authentication and retrieval working fine but after a week same user tries to retrieve data from fitbit but below exception occurred .

Scenario : First time User got authenticated and get their data and then after a week when user try to get his recent data then UserRedirectRequiredException exception occurred.

{"timestamp":"2017-06-12T08:27:00.344+0000","status":500,"error":"Internal Server Error","exception":"org.springframework.security.oauth2.client.resource.UserRedirectRequiredException","message":"org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.security.oauth2.client.resource.UserRedirectRequiredException: A redirect is required to get the users approval","path":"/data/fitbit/weight"}

Please advice.

@waqaslatif88 sorry for the late reply. Did you make progress on this? The Fitbit shim handles token refreshing correctly.

The most likely cause is that you went through the OAuth flow again using the same Fitbit credentials, e.g. you created a new Shimmer user with the same Fitbit username. Fitbit only allows a single refresh token per user, so the previous refresh token is invalidated when you re-authenticate, preventing Shimmer from getting data using the invalidated refresh token. This typically happens 8 hours after the re-authentication.

This issue has been closed due to inactivity.