08-22-2020 14:18 - edited 08-22-2020 14:21
08-22-2020 14:18 - edited 08-22-2020 14:21
Hi Fitbit Team!
[FYI - I did read the recommended articles here and here, they both say "Solved" but I don't understand what the solution was.]
I am having a similar issue, I have a test user who has granted authorization for scopes
I was able to successfully create subscriptions for the user for
However, when I make the request to get all subscriptions for the user
GET https://api.fitbit.com/1/user/-/apiSubscriptions.json
With their bearer token, it gives me an error
{
"errors": [
{
"errorType": "insufficient_scope",
"message": "This application does not have permission to access profile, settings data. Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process."
}
],
"success": false
}
As if the user has to have given access to all scopes in order to show which subscriptions they have.
On one of the other tickets it was mentioned that a ticket was put in to the DEV team, is it still in progress?
The other suggestions don't make sense to me.
Thanks for any info or update!
Jeff Humphry
Answered! Go to the Best Answer.
08-24-2020 13:31
08-24-2020 13:31
You need to have all 6 scopes I described earlier to POST, GET or DELETE a subscription without specifying a collection. I will create a ticket to clarify the functionality in the documentation.
08-24-2020 10:44
08-24-2020 10:44
In order to create a subscription for all collections using the syntax you posted, the user needs to grant activity, nutrition, weight, sleep AND profile and settings. This is described in the documentation at https://dev.fitbit.com/build/reference/web-api/subscriptions/#adding-a-subscription.
Gordon
08-24-2020 11:31 - edited 08-24-2020 11:33
08-24-2020 11:31 - edited 08-24-2020 11:33
Thanks @Gordon-C,
I did see that note in the instructions, but that is under the create (POST) subscription, which makes sense, because by not specifying the scope, you are defaulting to all scopes.
In my case, I'm trying to GET the list of subscriptions that I created for the user. I would assume that if I created the following: (subscription Ids are contrived)
Then when I call the endpoint to get the user's subscriptions
That it would tell me all the subscriptions that the user has, e.g.
{
"apiSubscriptions": [
{
"collectionType": "activities",
"ownerId": "3ZM4ZR",
"ownerType": "user",
"subscriberId": "DEF",
"subscriptionId": "ACT"
},
{
"collectionType": "sleep",
"ownerId": "3ZM4ZR",
"ownerType": "user",
"subscriberId": "DEF",
"subscriptionId": "SLP"
},
{
"collectionType": "foods",
"ownerId": "3ZM4ZR",
"ownerType": "user",
"subscriberId": "DEF",
"subscriptionId": "NUT"
},
{
"collectionType": "body",
"ownerId": "3ZM4ZR",
"ownerType": "user",
"subscriberId": "DEF",
"subscriptionId": "WGT"
}
]
}
But it's failing saying I need profile scope. - Which isn't a scope that I wanted to subscribe for, so I didn't configure my application for it.
Otherwise you would be saying that unless I configure my application for all scopes, even if I didn't intend to use them all, then I can't get a list of subscriptions for a user.
Maybe I have a conceptual misunderstanding here?
Thanks,
Jeff Humphry
08-24-2020 13:31
08-24-2020 13:31
You need to have all 6 scopes I described earlier to POST, GET or DELETE a subscription without specifying a collection. I will create a ticket to clarify the functionality in the documentation.