04-05-2021 12:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-05-2021 12:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hello everyone
I cannot connect to my fitbit acocunt via Visual Studio Code
When I type "npx fitbit" i have an 401 error
here is the text of the error
(node:17008) UnhandledPromiseRejectionWarning: Error: Fetch of https://api.fitbit.com:443/1/user/-/profile.json returned status 401 Unauthorized
at C:\Users\franc\Documents\fitbitapp\unicornwatchsense\node_modules\@fitbit\sdk-cli\lib\api\baseAPI.js:20:37
at processTicksAndRejections (internal/process/task_queues.js:97:5)
\api\userProfile.js:17:22)
at async main (C:\Users\franc\Documents\fitbitapp\unicornwatchsense\node_modules\@fitbit\sdk-cli\lib\cli.js:52:18)
(node:17008) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:17008) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are
not handled will terminate the Node.js process with a non-zero exit code.
I have this defect with a new project and an old project
Did someone face the same issue and how the issue was solved?
Thank you for help.
Answered! Go to the Best Answer.

Accepted Solutions
04-07-2021 15:32
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-07-2021 15:32
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
after a help on discord forum
the issue was due to the fact i "played" with the time of my PC
to solve this i launch in node on a command prompt: require('keytar').deletePassword('fitbit-sdk','production')

04-07-2021 10:50 - edited 04-07-2021 13:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-07-2021 10:50 - edited 04-07-2021 13:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hello
additional information
I am on windows
npx fitbit-build works only
the only command that doesn't work is: npx fitbit
i also tried that command after creating a new projet
is there a way to reset this command in node-modules from fitbit to enter again my credentials please?

04-07-2021 12:44
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-07-2021 12:44
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
maybe this?
fitbit$ logout

04-07-2021 15:32
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-07-2021 15:32
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
after a help on discord forum
the issue was due to the fact i "played" with the time of my PC
to solve this i launch in node on a command prompt: require('keytar').deletePassword('fitbit-sdk','production')

