07-30-2018 11:10
07-30-2018 11:10
Hey guys,
not really sure how to get the new access token using a refresh token. What command/process do I use?
08-20-2018 16:17
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
08-20-2018 16:17
Hi @ericmarnadi,
Here's the link to the documentation on using the refresh token to obtain a new access/refresh token pair: https://dev.fitbit.com/build/reference/web-api/oauth2/#refreshing-tokens.
Basically, you'll follow similar process for obtaining the access token by executing
POST https://api.fitbit.com/oauth2/token
but, instead you'll specifying the grant_type = refresh_token, your refresh token and the expiration time. Here's an example of what that would look like
POST https://api.fitbit.com/oauth2/token
Authorization: Basic Y2xpZW50X2lkOmNsaWVudCBzZWNyZXQ=
Content-Type: application/x-www-form-urlencoded
grant_type=refresh_token&refresh_token=abcdef01234567890abcdef01234567890abcdef01234567890abcdef0123456
In this example, we didn't specify the expiration time. Therefore, the default expiration time of 28800 seconds or 8 hours will be used.
Gordon
Best Answer