12-27-2020 13:15
12-27-2020 13:15
I'm using the following to make a request to the introspect API:
POST /1.1/oauth2/introspect?token=<token> HTTP/1.1
Host: api.fitbit.com
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer <token>
where <token> is an OAuth 2.0 token. This token works for requesting data from other endpoints
such as sleep and profile. The endpoint URL ends up looking like:
https://api.fitbit.com/1.1/oauth2/introspect?token=<token>
When I make the request I receive:
{
"errors": [
{
"errorType": "not_found",
"fieldName": "n/a",
"message": "The API you are requesting could not be found."
}
],
"success": false
}
Is there something I'm doing wrong here? It's strange because the endpoint seems to be validating my request correctly, for example if I remove the token parameter it lets me know that it is required. I also tried different HTTP methods, and I updated my profile to include Read and Write access incase that was necessary for POST requests. I also updated the token to have access to all scopes, nothing is working.
Answered! Go to the Best Answer.
12-29-2020 09:27
12-29-2020 09:27
I've tested several variations of the syntax, and you need to execute the endpoints as they are documented, https://dev.fitbit.com/build/reference/web-api/oauth2/#retrieve-state-of-tokens. You'll need to include "https://api.fitbit.com" in the URL and specify the token that you're retrieving the state of as a body parameter, not a query parameter.
12-29-2020 09:27
12-29-2020 09:27
I've tested several variations of the syntax, and you need to execute the endpoints as they are documented, https://dev.fitbit.com/build/reference/web-api/oauth2/#retrieve-state-of-tokens. You'll need to include "https://api.fitbit.com" in the URL and specify the token that you're retrieving the state of as a body parameter, not a query parameter.
12-29-2020 10:34
12-29-2020 10:34
Thank you @Gordon-C, my mistake! For those looking, the request now looks like:
POST /1.1/oauth2/introspect HTTP/1.1
Host: api.fitbit.com
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer <token>
token=<token>