11-22-2021 13:01
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

Jogger
1
0
0
11-22-2021 13:01
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I keep receiving an error with my fit bit request specified in step 4 of the authorization guide.
I get userCode from the call back url.
const sendJson = {
"method": "POST",
headers: {
Authorization: 'Basic MjNCSFM4OmM0ZTI2Mjg0MjIzOWQwNWQzZjljNzU2ZGExZDAzZmUw',
'Content-Type': "application/x-www-form-urlencoded"
}
};
var requestUrl = `https://api.fitbit.com/oauth2/token?clientId=23BHS8&code=${userCode}&grant_type=authorization_code`;
fetch(requestUrl, sendJson)
.then(response => response.json())
.then(data => console.log(data));
In postman my error returned is
"errors": [
{
"errorType": "invalid_grant",
"message": "Authorization code invalid: cff86e02c5c4c9f5bdbf3253c1c675661f3b16d4 Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process."
}
],
"success": false
}
Not sure why i am getting this error.

Labels:
- Labels:
-
API
-
JavaScript
-
SDK
0 REPLIES 0
