I sent a request to the Fit REST API to get Data Sources.
I have received the results at the prompt. But the value of dataSource in the JSON is empty as below.
{
"dataSource": []
}
What I did before I received this result
I sent the request with curl. Here are the prompts I entered:
curl \
> -H "Content-Type: application/json" \
> -H "Authorization: Bearer ya29.a0Ael9sCMf-tgDVCIN-DOnNe1FuCX9KjUlU9mP-_CSPS2GS7hGM7mOOhc1OuwcRxJASoS0_8h3C3BziCqON-TZZ5GAKnyiM3DsQhhsP8sFihNT52VnCsVMebICf1U0UzmttHCR7TyFyx30gVsOzZg0_Pt4IBPZQQaCgYKAQcSARMSFQF4udJhXOIhNiY2bOzgZWWevI96vw0165" \
> -v https://www.googleapis.com/fitness/v1/users/me/dataSources
curl's verbose option does not show any problematic errors.
The characters "HTTP/2 200" are seen in the prompt, so I think the HTTP response code is normal.
Also, I performed OAuth authorization according to the following site.
(Before sending the curl request, of course.)
Using OAuth 2.0 for Web Server Applications
I got the access token successfully.
Only one scope specified: fitness.heart_rate.read
description of my environment
Solved! Go to Solution.
I solved my problem of this question on my own.
I post here my solution.
I'm glad if someone in the same problem see this:
I haven't set the scope "fitness.heart_rate.read" on the application side.
I mean on my GCP Console. So I added the scope at OAuth consent menu.
It was not enough to include the scope as a request parameter in the OAuth URL.
Because the user-allowed scopes and the application-configured scopes did not match.
I solved my problem of this question on my own.
I post here my solution.
I'm glad if someone in the same problem see this:
I haven't set the scope "fitness.heart_rate.read" on the application side.
I mean on my GCP Console. So I added the scope at OAuth consent menu.
It was not enough to include the scope as a request parameter in the OAuth URL.
Because the user-allowed scopes and the application-configured scopes did not match.
User | Count |
---|---|
3 | |
1 | |
1 | |
1 |