react-native-google-fit: Error: 4: The user must be signed in to make this API call. getSleepSamples()

Hi I encounter this error ‘The user must be signed in to make this API call’, using the given sample regarding with the sleep method . However, the authResult is {“success”:true}, not sure why it says the user is not logged in. but when I use the other function it returns ok.

`const options = { scopes: [ Scopes.FITNESS_ACTIVITY_READ, Scopes.FITNESS_ACTIVITY_WRITE, Scopes.FITNESS_BODY_READ, Scopes.FITNESS_BODY_WRITE, Scopes.FITNESS_SLEEP_READ, ], } GoogleFit.authorize(options) .then(authResult => { if (authResult.success) { const opt = { startDate: ‘2020-01-01T12:33:18.873Z’, // required, timestamp or ISO8601 string endDate: new Date().toISOString(), // required, timestamp or ISO8601 string };

  GoogleFit.getSleepSamples(opt).then((res) => {
    console.log(res)
  });
} else {
    console.log(authResult.message);
}

}) .catch(() => { console.log(“AUTH_ERROR”); })`

thanks for updates

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16

Most upvoted comments

@Ransoy Can you test this merge with only your current scopes without nutrition to check if the issue persists?