12-06-2020 05:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-06-2020 05:08
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi.
I am new to web development and will use Fitbit API for a small project for personal use using Node js and we're trying to build a server side API where it is ran by a CRON job daily and the fetched data from the Fitbit APIs will be saved to the database. My question is, would this be possible? because the authorization page will show after running it using CRON. But local development will only ask me once to permit the authorization page.
Thank you.

- Labels:
-
API
-
JavaScript
-
SDK
12-09-2020 17:26
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



12-09-2020 17:26
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi @rdaltonjay
Welcome to the forums!
Yes this is possible, as many of our developers already implement cron jobs in their integrations to pull data. Could you tell me which authorization flow (implicit or auth code) you're using for your application?

12-10-2020 04:27
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-10-2020 04:27
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hello @JohnFitbit
Thank you for replying. We were able to get it to work now. We just had to implement the refresh token to fetch new access token and to have it perpetually running. We are using implicit for authorization flow.

12-10-2020 17:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



12-10-2020 17:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hi @rdaltonjay
Happy to hear your implementation is up and running. However, I think there is confusion regarding your authorization flow statement. The Implicit Grant Flow does not use refresh tokens. When an access token obtained through the Implicit Grant Flow expires, the user will need to go through the authorization process again to provide consent. The Authorization Code Grant flow on the other hand, uses refresh tokens to refresh an expired access token. Did you mean to say that you were using the Authorization Code Grant Flow. not Implicit?
Documentation:
- https://dev.fitbit.com/build/reference/web-api/oauth2/#authorization-code-grant-flow
- https://dev.fitbit.com/build/reference/web-api/oauth2/#implicit-grant-flow
Let me know if you have additional questions.

